fix: invalid metric should raise an exception (#20882)

This commit is contained in:
Yongjie Zhao
2022-07-28 08:15:43 +08:00
committed by GitHub
parent 383313b105
commit 718bc3062e
7 changed files with 34 additions and 20 deletions

View File

@@ -43,5 +43,5 @@
"granularity_sqla": null,
"autozoom": true,
"url_params": {},
"size": 100
"size": "100"
}

View File

@@ -45,5 +45,5 @@
"granularity_sqla": null,
"autozoom": true,
"url_params": {},
"size": 100
"size": "100"
}

View File

@@ -716,7 +716,7 @@ class TestPairedTTest(SupersetTestCase):
self.assertEqual(data, expected)
def test_get_data_empty_null_keys(self):
form_data = {"groupby": [], "metrics": ["", None]}
form_data = {"groupby": [], "metrics": [""]}
datasource = self.get_datasource_mock()
# Test data
raw = {}
@@ -739,19 +739,13 @@ class TestPairedTTest(SupersetTestCase):
"group": "All",
}
],
"NULL": [
{
"values": [
{"x": 100, "y": 10},
{"x": 200, "y": 20},
{"x": 300, "y": 30},
],
"group": "All",
}
],
}
self.assertEqual(data, expected)
form_data = {"groupby": [], "metrics": [None]}
with self.assertRaises(ValueError):
viz.viz_types["paired_ttest"](datasource, form_data)
class TestPartitionViz(SupersetTestCase):
@patch("superset.viz.BaseViz.query_obj")