def test_weird_nesting(self): node = parseq( Q(a='A', b='B'), ( Q(c='C') | Q(d='D') ) ) self.assertEqual(unicode(node), '(a = A AND b = B) AND (c = C OR d = D)') node = parseq(( ( Q(c='C') | Q(d='D') ) | ( Q(e='E', f='F') ) ), a='A', b='B') self.assertEqual(unicode(node), '(a = A AND b = B) AND (c = C OR d = D OR (e = E AND f = F))') node = parseq(( ( Q(c='C') | Q(d='D') ) | ( Q(e='E', f='F') | Q(g='G', h='H') ) ), a='A', b='B') self.assertEqual(unicode(node), '(a = A AND b = B) AND ((c = C OR d = D) OR ((e = E AND f = F) OR (h = H AND g = G)))')
def test_nesting(self): node = parseq((Q(a="A") | Q(b="B")), (Q(c="C") | Q(d="D"))) self.assertEqual(unicode(node), "(a = A OR b = B) AND (c = C OR d = D)") node = parseq((Q(a="A") | Q(b="B")) & (Q(c="C") | Q(d="D"))) self.assertEqual(unicode(node), "((a = A OR b = B) AND (c = C OR d = D))") node = parseq((Q(a="A") | Q(b="B")) | (Q(c="C") | Q(d="D"))) self.assertEqual(unicode(node), "((a = A OR b = B) OR (c = C OR d = D))")
def test_mixed(self): node = parseq(Q(a="A"), Q(b="B"), c="C", d="D") self.assertEqual(unicode(node), "a = A AND b = B AND (c = C AND d = D)") node = parseq((Q(a="A") & Q(b="B")), c="C", d="D") self.assertEqual(unicode(node), "(c = C AND d = D) AND (a = A AND b = B)") node = parseq((Q(a="A") | Q(b="B")), c="C", d="D") self.assertEqual(unicode(node), "(c = C AND d = D) AND (a = A OR b = B)")
def test_node_and_q(self): node = parseq( (Q(a='A') & Q(b='B')) | (Q(c='C')) ) self.assertEqual(unicode(node), '(c = C OR (a = A AND b = B))') node = parseq(Q(c='C') & (Q(a='A') | Q(b='B'))) self.assertEqual(unicode(node), '((c = C) AND (a = A OR b = B))')
def test_mixed(self): node = parseq(Q(a='A'), Q(b='B'), c='C', d='D') self.assertEqual(unicode(node), 'a = A AND b = B AND (c = C AND d = D)') node = parseq((Q(a='A') & Q(b='B')), c='C', d='D') self.assertEqual(unicode(node), '(c = C AND d = D) AND (a = A AND b = B)') node = parseq((Q(a='A') | Q(b='B')), c='C', d='D') self.assertEqual(unicode(node), '(c = C AND d = D) AND (a = A OR b = B)')
def test_weird_nesting(self): node = parseq(Q(a="A", b="B"), (Q(c="C") | Q(d="D"))) self.assertEqual(unicode(node), "(a = A AND b = B) AND (c = C OR d = D)") node = parseq(((Q(c="C") | Q(d="D")) | (Q(e="E", f="F"))), a="A", b="B") self.assertEqual(unicode(node), "(a = A AND b = B) AND (c = C OR d = D OR (e = E AND f = F))") node = parseq(((Q(c="C") | Q(d="D")) | (Q(e="E", f="F") | Q(g="G", h="H"))), a="A", b="B") self.assertEqual( unicode(node), "(a = A AND b = B) AND ((c = C OR d = D) OR ((e = E AND f = F) OR (h = H AND g = G)))" )
def test_simple(self): node = Q(a="A") | Q(b="B") self.assertEqual(unicode(node), "a = A OR b = B") node = parseq(Q(a="A") | Q(b="B")) self.assertEqual(unicode(node), "(a = A OR b = B)") node = Q(a="A") & Q(b="B") self.assertEqual(unicode(node), "a = A AND b = B") node = parseq(Q(a="A") & Q(b="B")) self.assertEqual(unicode(node), "(a = A AND b = B)")
def test_simple(self): node = Q(a='A') | Q(b='B') self.assertEqual(unicode(node), 'a = A OR b = B') node = parseq(Q(a='A') | Q(b='B')) self.assertEqual(unicode(node), '(a = A OR b = B)') node = Q(a='A') & Q(b='B') self.assertEqual(unicode(node), 'a = A AND b = B') node = parseq(Q(a='A') & Q(b='B')) self.assertEqual(unicode(node), '(a = A AND b = B)')
def test_nesting(self): node = parseq( (Q(a='A') | Q(b='B')), (Q(c='C') | Q(d='D')) ) self.assertEqual(unicode(node), '(a = A OR b = B) AND (c = C OR d = D)') node = parseq( (Q(a='A') | Q(b='B')) & (Q(c='C') | Q(d='D')) ) self.assertEqual(unicode(node), '((a = A OR b = B) AND (c = C OR d = D))') node = parseq( (Q(a='A') | Q(b='B')) | (Q(c='C') | Q(d='D')) ) self.assertEqual(unicode(node), '((a = A OR b = B) OR (c = C OR d = D))')
def test_weird_nesting(self): node = parseq(Q(a='A', b='B'), (Q(c='C') | Q(d='D'))) self.assertEqual(unicode(node), '(a = A AND b = B) AND (c = C OR d = D)') node = parseq(((Q(c='C') | Q(d='D')) | (Q(e='E', f='F'))), a='A', b='B') self.assertEqual( unicode(node), '(a = A AND b = B) AND (c = C OR d = D OR (e = E AND f = F))') node = parseq( ((Q(c='C') | Q(d='D')) | (Q(e='E', f='F') | Q(g='G', h='H'))), a='A', b='B') self.assertEqual( unicode(node), '(a = A AND b = B) AND ((c = C OR d = D) OR ((e = E AND f = F) OR (h = H AND g = G)))' )
def test_kwargs(self): node = parseq(a="A", b="B") self.assertEqual(unicode(node), "(a = A AND b = B)")
def test_node_and_q(self): node = parseq((Q(a='A') & Q(b='B')) | (Q(c='C'))) self.assertEqual(unicode(node), '(c = C OR (a = A AND b = B))') node = parseq(Q(c='C') & (Q(a='A') | Q(b='B'))) self.assertEqual(unicode(node), '((c = C) AND (a = A OR b = B))')
def test_kwargs(self): node = parseq(a='A', b='B') self.assertEqual(unicode(node), '(a = A AND b = B)')
def test_node_and_q(self): node = parseq((Q(a="A") & Q(b="B")) | (Q(c="C"))) self.assertEqual(unicode(node), "(c = C OR (a = A AND b = B))") node = parseq(Q(c="C") & (Q(a="A") | Q(b="B"))) self.assertEqual(unicode(node), "((c = C) AND (a = A OR b = B))")