def test_intersection_with_intersection(self): a, b, c, d = Query(), Query(), Query(), Query() self.check_both(a & b, c & d, Intersection(a, b, c, d))
def test_intersection_query_with_its_inversion(self): q = Query() self.check_both(q, ~q, ~Q())
def test_query_with_intersection(self): a, b, c = Query(), Query(), Query() self.check_both(a & b, c, Intersection(a, b, c))
def test_intersection_everything(self): q = Query() self.check_both(Q(), q, q)
def test_intersection_nothing(self): self.check_both(~Q(), Query(), ~Q())
def test_query_with_union(self): a, b, c = Query(), Query(), Query() self.check_both(a | b, c, Union(a, b, c))
def test_union_with_union(self): a, b, c, d = Query(), Query(), Query(), Query() self.check_both(a | b, c | d, Union(a, b, c, d))
def test_with_nothing(self): q = Query() self.check_both(~Q(), q, q)
def test_with_everything(self): self.check_both(Q(), Query(), Q())
def test_inversion(self): q = Query() assert_is_instance(~q, Inversion) eq_((~q).subquery, q)
def test_intersection(self): a, b = Query(), Query() q = a & b assert_is_instance(q, Intersection) assert_set_equal(q.subqueries, set((a, b)))
def test_union(self): a, b = Query(), Query() q = a | b assert_is_instance(q, Union) assert_set_equal(q.subqueries, set((a, b)))