[fix] Enforce the query result to contain a data-frame (#8935)

This commit is contained in:
John Bodley
2020-01-08 11:50:26 -08:00
committed by GitHub
parent 2a94150097
commit 2d456e88eb
5 changed files with 97 additions and 93 deletions

View File

@@ -251,7 +251,7 @@ class SqlaTableModelTestCase(SupersetTestCase):
else:
self.assertNotIn("JOIN", sql.upper())
spec.allows_joins = old_inner_join
self.assertIsNotNone(qr.df)
self.assertFalse(qr.df.empty)
return qr.df
def test_query_with_expr_groupby_timeseries(self):
@@ -262,8 +262,9 @@ class SqlaTableModelTestCase(SupersetTestCase):
df1 = self.query_with_expr_helper(is_timeseries=True, inner_join=True)
df2 = self.query_with_expr_helper(is_timeseries=True, inner_join=False)
self.assertIsNotNone(df2) # df1 can be none if the db does not support join
if df1 is not None:
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)
)