コード例 #1
0
def test_not_with_q(where):
    where.where(Not(Q(a=1) | Q(b=2)))
    assert str(where) == 'WHERE NOT(("a" = 1 OR "b" = 2))'
コード例 #2
0
 def test_more_complicated(self):
     self.having.where((Q(a=1) & Q(b=2)) | Q(c=3))
     self.assertEqual(str(self.having),
                      'HAVING (("a" = 1 AND "b" = 2) OR "c" = 3)')
コード例 #3
0
def test_qobject_in_qobject(where):
    where.where(Q(Q(a=1) | Q(b=2)) & Q(c=3))
    assert str(where) == 'WHERE (("a" = 1 OR "b" = 2) AND "c" = 3)'
コード例 #4
0
 def test_more_conditions_in_q(self):
     self.tables.set('t')
     self.tables.join('a').on(Q(a=42, b=24) | Q(x='y'))
     self.assertEqual(
         str(self.tables),
         '"t" JOIN "a" ON (("a" = 42 AND "b" = 24) OR "x" = \'y\')')
コード例 #5
0
 def test_more_complicated(self, tables):
     tables.set('t')
     tables.join('a').on((Q(a=1) & Q(b=2)) | Q(c=3))
     assert str(
         tables) == '"t" JOIN "a" ON (("a" = 1 AND "b" = 2) OR "c" = 3)'
コード例 #6
0
def test_more_complicated(having):
    having.where((Q(a=1) & Q(b=2)) | Q(c=3))
    assert str(having) == 'HAVING (("a" = 1 AND "b" = 2) OR "c" = 3)'
コード例 #7
0
 def test_simple_and(self):
     self.tables.set('t')
     self.tables.join('a').on(Q(x='y') & Q(y='x'))
     self.assertEqual(str(self.tables),
                      '"t" JOIN "a" ON ("x" = \'y\' AND "y" = \'x\')')
コード例 #8
0
 def test_three_qobjects(self):
     self.where.where(Q(a=1) | Q(a=2), Q(b=1) | Q(b=2), Q(c=1))
     self.assertEqual(str(self.where), 'WHERE ("a" = 1 OR "a" = 2) AND ("b" = 1 OR "b" = 2) AND "c" = 1')
コード例 #9
0
 def test_qobject_in_qobject(self):
     self.where.where(Q(Q(a=1) | Q(b=2)) & Q(c=3))
     self.assertEqual(str(self.where), 'WHERE (("a" = 1 OR "b" = 2) AND "c" = 3)')
コード例 #10
0
 def test_more_complicated(self):
     self.where.where((Q(a=1) & Q(b=2)) | Q(c=3))
     self.assertEqual(str(self.where), 'WHERE (("a" = 1 AND "b" = 2) OR "c" = 3)')
コード例 #11
0
 def test_more_conditions_in_q(self):
     self.where.where(Q(a=42, b=24) | Q(x='y'))
     self.assertEqual(str(self.where), 'WHERE (("a" = 42 AND "b" = 24) OR "x" = \'y\')')
コード例 #12
0
 def test_simple_and(self):
     self.where.where(Q(x='y') & Q(y='x'))
     self.assertEqual(str(self.where), 'WHERE ("x" = \'y\' AND "y" = \'x\')')
コード例 #13
0
 def test_simple_or(self):
     self.where.where(Q(x='y') | Q(y='x'))
     self.assertEqual(str(self.where), 'WHERE ("x" = \'y\' OR "y" = \'x\')')
コード例 #14
0
 def test_more_conditions_in_q(self):
     self.having.where(Q(a=42, b=24) | Q(x='y'))
     self.assertEqual(str(self.having),
                      'HAVING (("a" = 42 AND "b" = 24) OR "x" = \'y\')')
コード例 #15
0
def test_simple_or(having):
    having.where(Q(x='y') | Q(y='x'))
    assert str(having) == 'HAVING ("x" = \'y\' OR "y" = \'x\')'
コード例 #16
0
def test_simple_or(where):
    where.where(Q(x='y') | Q(y='x'))
    assert str(where) == 'WHERE ("x" = \'y\' OR "y" = \'x\')'
コード例 #17
0
def test_simple_and(having):
    having.where(Q(x='y') & Q(y='x'))
    assert str(having) == 'HAVING ("x" = \'y\' AND "y" = \'x\')'
コード例 #18
0
def test_simple_and(where):
    where.where(Q(x='y') & Q(y='x'))
    assert str(where) == 'WHERE ("x" = \'y\' AND "y" = \'x\')'
コード例 #19
0
def test_more_conditions_in_q(having):
    having.where(Q(a=42, b=24) | Q(x='y'))
    assert str(having) == 'HAVING (("a" = 42 AND "b" = 24) OR "x" = \'y\')'
コード例 #20
0
def test_more_complicated(where):
    where.where((Q(a=1) & Q(b=2)) | Q(c=3))
    assert str(where) == 'WHERE (("a" = 1 AND "b" = 2) OR "c" = 3)'
コード例 #21
0
 def test_more_complicated(self):
     self.tables.set('t')
     self.tables.join('a').on((Q(a=1) & Q(b=2)) | Q(c=3))
     self.assertEqual(str(self.tables),
                      '"t" JOIN "a" ON (("a" = 1 AND "b" = 2) OR "c" = 3)')
コード例 #22
0
def test_more_conditions_in_q(where):
    where.where(Q(a=42, b=24) | Q(x='y'))
    assert str(where) == 'WHERE (("a" = 42 AND "b" = 24) OR "x" = \'y\')'
コード例 #23
0
 def test_simple_and(self, tables):
     tables.set('t')
     tables.join('a').on(Q(x='y') & Q(y='x'))
     assert str(tables) == '"t" JOIN "a" ON ("x" = \'y\' AND "y" = \'x\')'
コード例 #24
0
def test_three_qobjects(where):
    where.where(Q(a=1) | Q(a=2), Q(b=1) | Q(b=2), Q(c=1))
    assert str(where) == 'WHERE ("a" = 1 OR "a" = 2) AND ("b" = 1 OR "b" = 2) AND "c" = 1'
コード例 #25
0
 def test_more_conditions_in_q(self, tables):
     tables.set('t')
     tables.join('a').on(Q(a=42, b=24) | Q(x='y'))
     assert str(
         tables
     ) == '"t" JOIN "a" ON (("a" = 42 AND "b" = 24) OR "x" = \'y\')'
コード例 #26
0
 def test_simple_and(self):
     self.having.where(Q(x='y') & Q(y='x'))
     self.assertEqual(str(self.having),
                      'HAVING ("x" = \'y\' AND "y" = \'x\')')