Пример #1
0
 def test_inequality(self):
     cond = iter(generate_conditions())
     cond = iter(zip(cond, cond))
     for conditions1, conditions2 in zip(cond, cond):
         qs1 = (Q(**conditions1[0]), Q(**conditions1[1]))
         qs2 = (Q(**conditions2[0]), Q(**conditions2[1]))
         assert_not_equal(Union(*qs1), Union(*qs2))
Пример #2
0
 def test_inversion_inversion(self):
     q = Q(foo=42)
     assert_is(~~q, q)
Пример #3
0
 def test_q_intersection(self):
     q = Q(foo=42) & Q(bar=42)
     eq_(q, Q(foo=42, bar=42))
     assert_is_instance(q, Q)
Пример #4
0
 def test_intersection_query_with_its_inversion(self):
     q = Query()
     self.check_both(q, ~q, ~Q())
Пример #5
0
 def test_intersection_nothing(self):
     self.check_both(~Q(), Query(), ~Q())
Пример #6
0
 def test_inequality(self):
     args = iter(((None, ), (0, ), (0, 3), (0, 3, 2)))
     for s1, s2 in zip(args, args):
         assert_not_equal(Slice(Q(), slice(*s1)), Slice(Q(), slice(*s2)))
Пример #7
0
 def test_with_everything(self):
     self.check_both(Q(), Query(), Q())
Пример #8
0
 def test_repr(self):
     for conditions in generate_conditions():
         q = ~Q(**conditions)
         eq_(q, eval(repr(q)))
Пример #9
0
 def test_repr(self):
     for fields in ((), ('foo', ), ('foo', '-bar'), ('foo', '-bar', 'baz')):
         q = Q().order_by(*fields)
         eq_(q, eval(repr(q)))
Пример #10
0
 def test_q(self):
     matching = [2, 3, 5, 7]
     q = Q()
     q.match = lambda obj_cache, pk: pk in matching
     self.assert_execute(q, matching)
Пример #11
0
 def test_inequality(self):
     args = iter(((), ('foo', ), ('foo', '-bar'), ('foo', '-bar', 'baz')))
     for fields1, fields2 in zip(args, args):
         assert_not_equal(Ordered(Q(), *fields1), Ordered(Q(), *fields2))
Пример #12
0
 def test_equality(self):
     for fields in ((), ('foo', ), ('foo', '-bar'), ('foo', '-bar', 'baz')):
         eq_(Ordered(Q(), *fields), Ordered(Q(), *fields))
Пример #13
0
 def test_repr(self):
     for s in ((None, ), (0, ), (0, 3), (0, 3, 2)):
         q = Q()[slice(*s)]
         eq_(q, eval(repr(q)))
Пример #14
0
 def test_equality(self):
     for conditions in generate_conditions():
         q = Q(**conditions)
         eq_(Inversion(q), Inversion(q))
Пример #15
0
 def test_with_nothing(self):
     q = Query()
     self.check_both(~Q(), q, q)
Пример #16
0
 def test_inequality(self):
     cond = iter(generate_conditions())
     for conditions1, conditions2 in zip(cond, cond):
         assert_not_equal(~Q(**conditions1), ~Q(**conditions2))
Пример #17
0
 def test_equality(self):
     for conditions in generate_conditions():
         eq_(Q(**conditions), Q(**conditions))
Пример #18
0
 def test_equality(self):
     cond = iter(generate_conditions())
     for conditions1, conditions2 in zip(cond, cond):
         qs = (Q(**conditions1), Q(**conditions2))
         eq_(Union(*qs), Union(*qs))
Пример #19
0
 def test_intersection_everything(self):
     q = Query()
     self.check_both(Q(), q, q)
Пример #20
0
 def test_repr(self):
     cond = iter(generate_conditions())
     for conditions1, conditions2 in zip(cond, cond):
         q = Q(**conditions1) & Q(**conditions2)
         eq_(q, eval(repr(q)))
Пример #21
0
 def test_equality(self):
     for s in ((None, ), (0, ), (0, 3), (0, 3, 2)):
         eq_(Slice(Q(), slice(*s)), Slice(Q(), slice(*s)))