Sample test data (#10487)

Co-authored-by: bogdan kyryliuk <bogdankyryliuk@dropbox.com>
This commit is contained in:
Bogdan
2020-08-03 09:08:49 -07:00
committed by GitHub
parent 821916a681
commit ab404ea2cf
8 changed files with 46 additions and 19 deletions

View File

@@ -231,7 +231,7 @@ class TestSqlaTableModel(SupersetTestCase):
spec.allows_joins = inner_join
arbitrary_gby = "state || gender || '_test'"
arbitrary_metric = dict(
label="arbitrary", expressionType="SQL", sqlExpression="COUNT(1)"
label="arbitrary", expressionType="SQL", sqlExpression="SUM(sum_boys)"
)
query_obj = dict(
groupby=[arbitrary_gby, "name"],
@@ -264,13 +264,30 @@ class TestSqlaTableModel(SupersetTestCase):
return ret
df1 = self.query_with_expr_helper(is_timeseries=True, inner_join=True)
name_list1 = cannonicalize_df(df1).name.values.tolist()
df2 = self.query_with_expr_helper(is_timeseries=True, inner_join=False)
name_list2 = cannonicalize_df(df1).name.values.tolist()
self.assertFalse(df2.empty)
# df1 can be empty if the db does not support join
if not df1.empty:
pandas.testing.assert_frame_equal(
cannonicalize_df(df1), cannonicalize_df(df2)
)
expected_namelist = [
"Anthony",
"Brian",
"Christopher",
"Daniel",
"David",
"Eric",
"James",
"Jeffrey",
"John",
"Joseph",
"Kenneth",
"Kevin",
"Mark",
"Michael",
"Paul",
]
assert name_list2 == expected_namelist
assert name_list1 == expected_namelist
def test_query_with_expr_groupby(self):
self.query_with_expr_helper(is_timeseries=False)