This is an automated email from the ASF dual-hosted git repository.

johnbodley pushed a commit to branch feature--embeddable-charts-pilot
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit d167c6403949a5ba0344e865d896990a4df30484
Author: Conglei Shi <[email protected]>
AuthorDate: Mon Dec 17 15:16:52 2018 -0800

    fix test for viz
---
 superset/viz.py    |  8 ++++----
 tests/viz_tests.py | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/superset/viz.py b/superset/viz.py
index 6c0a5f5..1fbd7c9 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -1798,7 +1798,7 @@ class FilterBoxViz(BaseViz):
         return None
 
     def run_extra_queries(self):
-        qry = self.filter__query_obj()
+        qry = self.filter_query_obj()
         filters = [g for g in self.form_data['groupby']]
         self.dataframes = {}
         for flt in filters:
@@ -1806,7 +1806,7 @@ class FilterBoxViz(BaseViz):
             df = self.get_df_payload(query_obj=qry).get('df')
             self.dataframes[flt] = df
 
-    def filter__query_obj(self):
+    def filter_query_obj(self):
         qry = super(FilterBoxViz, self)._query_obj()
         groupby = self.form_data.get('groupby')
         if len(groupby) < 1 and not self.form_data.get('date_filter'):
@@ -2091,7 +2091,7 @@ class BaseDeckGLViz(BaseViz):
         self.metric = self.form_data.get('size')
         return [self.metric] if self.metric else []
 
-    def process_spatial__query_obj(self, key, group_by):
+    def process_spatial_query_obj(self, key, group_by):
         group_by.extend(self.get_spatial_columns(key))
 
     def get_spatial_columns(self, key):
@@ -2189,7 +2189,7 @@ class BaseDeckGLViz(BaseViz):
         gb = []
 
         for key in self.spatial_control_keys:
-            self.process_spatial__query_obj(key, gb)
+            self.process_spatial_query_obj(key, gb)
 
         if fd.get('dimension'):
             gb += [fd.get('dimension')]
diff --git a/tests/viz_tests.py b/tests/viz_tests.py
index e4232c4..c6f890b 100644
--- a/tests/viz_tests.py
+++ b/tests/viz_tests.py
@@ -310,7 +310,7 @@ class TableVizTestCase(SupersetTestCase):
         self.assertEqual('(value3 in (\'North America\'))', 
query_obj['extras']['where'])
         self.assertEqual('', query_obj['extras']['having'])
 
-    @patch('superset.viz.BaseViz.query_obj')
+    @patch('superset.viz.BaseViz._query_obj')
     def test_query_obj_merges_percent_metrics(self, super_query_obj):
         datasource = self.get_datasource_mock()
         form_data = {
@@ -326,9 +326,9 @@ class TableVizTestCase(SupersetTestCase):
         self.assertEqual([
             'sum__A', 'count', 'avg__C',
             'avg__B', 'max__Y',
-        ], query_obj['metrics'])
+        ], [metric['label'] for metric in query_obj['metrics']])
 
-    @patch('superset.viz.BaseViz.query_obj')
+    @patch('superset.viz.BaseViz._query_obj')
     def test_query_obj_throws_columns_and_metrics(self, super_query_obj):
         datasource = self.get_datasource_mock()
         form_data = {
@@ -345,7 +345,7 @@ class TableVizTestCase(SupersetTestCase):
         with self.assertRaises(Exception):
             test_viz.query_obj()
 
-    @patch('superset.viz.BaseViz.query_obj')
+    @patch('superset.viz.BaseViz._query_obj')
     def test_query_obj_merges_all_columns(self, super_query_obj):
         datasource = self.get_datasource_mock()
         form_data = {
@@ -362,7 +362,7 @@ class TableVizTestCase(SupersetTestCase):
         self.assertEqual([], query_obj['groupby'])
         self.assertEqual([['colA', 'colB'], ['colC']], query_obj['orderby'])
 
-    @patch('superset.viz.BaseViz.query_obj')
+    @patch('superset.viz.BaseViz._query_obj')
     def test_query_obj_uses_sortby(self, super_query_obj):
         datasource = self.get_datasource_mock()
         form_data = {
@@ -376,7 +376,7 @@ class TableVizTestCase(SupersetTestCase):
         query_obj = test_viz.query_obj()
         self.assertEqual([
             'colA', 'colB', '__time__',
-        ], query_obj['metrics'])
+        ], [metric['label'] for metric in query_obj['metrics']])
         self.assertEqual([(
             '__time__', True,
         )], query_obj['orderby'])
@@ -523,7 +523,7 @@ class PairedTTestTestCase(SupersetTestCase):
 
 class PartitionVizTestCase(SupersetTestCase):
 
-    @patch('superset.viz.BaseViz.query_obj')
+    @patch('superset.viz.BaseViz._query_obj')
     def test_query_obj_time_series_option(self, super_query_obj):
         datasource = self.get_datasource_mock()
         form_data = {}
@@ -850,7 +850,7 @@ class TimeSeriesTableVizTestCase(SupersetTestCase):
         }
         self.assertEqual(expected, data['records'])
 
-    @patch('superset.viz.BaseViz.query_obj')
+    @patch('superset.viz.BaseViz._query_obj')
     def test_query_obj_throws_metrics_and_groupby(self, super_query_obj):
         datasource = self.get_datasource_mock()
         form_data = {

Reply via email to