How to use the cartoframes.viz.Source function in cartoframes

To help you get started, we’ve selected a few cartoframes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CartoDB / cartoframes / test / viz / test_map.py View on Github external
def test_map_publish_update_name(self):
        dataset = DatasetMock('fake_table', credentials=self.credentials)
        map = MapMock(Layer(Source(dataset)))

        name = 'cf_publish'
        map.publish(name, credentials=self.credentials)
        new_name = 'cf_update'
        kuviz_dict = map.update_publication(new_name, password=None)
        self.assert_kuviz_dict(kuviz_dict, new_name, PRIVACY_PUBLIC)
        self.assert_kuviz(map._kuviz, new_name, PRIVACY_PUBLIC)
github CartoDB / cartoframes / test / viz / helpers / test_cluster_size_layer.py View on Github external
def setUp(self):
        self.orig_compute_query_bounds = Source._compute_query_bounds
        Source._compute_query_bounds = Mock(return_valye=None)
github CartoDB / cartoframes / test / viz / helpers / test_size_category_layer.py View on Github external
def setUp(self):
        self.orig_compute_query_bounds = Source._compute_query_bounds
        Source._compute_query_bounds = Mock(return_valye=None)
github CartoDB / cartoframes / test / viz / test_map.py View on Github external
def test_default_interactive_layer(self):
        """Map layer should get the default event if the interactivity is set to []"""
        source_1 = Source(build_geojson([-10, 0], [-10, 0]))
        layer = Layer(
            source_1,
            popup={}
        )

        map = Map(layer)
        self.assertEqual(map.layer_defs[0].get('interactivity'), [])
github CartoDB / cartoframes / test / viz / helpers / test_size_continuous_layer.py View on Github external
def tearDown(self):
        Source._compute_query_bounds = self.orig_compute_query_bounds
github CartoDB / cartoframes / tests / unit / viz / test_layout.py View on Github external
def test_global_camera(self):
        """Layout should return the correct camera for each map"""
        layout = Layout([
            Map(Layer(Source(SOURCE))),
            Map(Layer(Source(SOURCE)))
        ], viewport={'zoom': 5})

        assert layout._layout[0].get('camera') == {
            'bearing': None, 'center': None, 'pitch': None, 'zoom': 5}
        assert layout._layout[1].get('camera') == {
            'bearing': None, 'center': None, 'pitch': None, 'zoom': 5}
github CartoDB / cartoframes / test / viz / test_kuviz.py View on Github external
def test_kuviz_publisher_create_remote_sync(self):
        dataset = DatasetMock('fake_table', credentials=self.credentials)
        vmap = Map(Layer(Source(dataset)))

        kp = KuvizPublisherMock(vmap.layers)
        self.assertEqual(kp.is_sync(), True)
github CartoDB / cartoframes / tests / unit / viz / test_layer.py View on Github external
def test_initialization_objects(self, mocker):
        """Layer should initialize layer attributes"""
        setup_mocks(mocker, 'layer_source')
        layer = Layer(Source('layer_source', credentials=Credentials('fakeuser')))

        assert layer.is_basemap is False
        assert layer.source_data == 'SELECT * FROM "public"."layer_source"'
        assert isinstance(layer.source, Source)
        assert isinstance(layer.style, Style)
        assert isinstance(layer.popup, Popup)
        assert isinstance(layer.legend, Legend)
        assert layer.interactivity == []