def test_union(get_dataframe): """ Test union with all set to false dedupes. """ q1 = CustomQuery("SELECT * FROM events.calls LIMIT 10") union = q1.union(q1, all=False) union_df = get_dataframe(union) single_id = union_df[union_df.id == "5wNJA-PdRJ4-jxEdG-yOXpZ"] assert len(single_id) == 2
def test_union_all(get_dataframe): """ Test default union behaviour keeps duplicates. """ q1 = CustomQuery("SELECT * FROM events.calls LIMIT 10") union_all = q1.union(q1) union_all_df = get_dataframe(union_all) single_id = union_all_df[union_all_df.id == "5wNJA-PdRJ4-jxEdG-yOXpZ"] assert len(single_id) == 4
class test_query_union(TestCase): def setUp(self): self.q1 = CustomQuery("SELECT * FROM events.calls LIMIT 10") def test_union_all(self): """ Test union with all = True """ union_all = self.q1.union(self.q1) union_all_df = union_all.get_dataframe() single_id = union_all_df[union_all_df.id == "5wNJA-PdRJ4-jxEdG-yOXpZ"] assert len(single_id) == 4 def test_union(self): """ Test union with all = False """ union = self.q1.union(self.q1, all=False) union_df = union.get_dataframe() single_id = union_df[union_df.id == "5wNJA-PdRJ4-jxEdG-yOXpZ"] assert len(single_id) == 2