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))'
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)')
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)'
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\')')
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)'
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)'
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\')')
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')
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)')
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)')
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\')')
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\')')
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\')')
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\')')
def test_simple_or(having): having.where(Q(x='y') | Q(y='x')) assert str(having) == 'HAVING ("x" = \'y\' OR "y" = \'x\')'
def test_simple_or(where): where.where(Q(x='y') | Q(y='x')) assert str(where) == 'WHERE ("x" = \'y\' OR "y" = \'x\')'
def test_simple_and(having): having.where(Q(x='y') & Q(y='x')) assert str(having) == 'HAVING ("x" = \'y\' AND "y" = \'x\')'
def test_simple_and(where): where.where(Q(x='y') & Q(y='x')) assert str(where) == 'WHERE ("x" = \'y\' AND "y" = \'x\')'
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\')'
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)'
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)')
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\')'
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\')'
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'
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\')'
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\')')