def test_operation_with_nested_brackets(self): result = InfixBoolQuery.parseString('((a != 1) & (b != 2))', parseAll=True) rel1, op, rel2 = result.AttribQuery assert ('a', '!=', 1) == tuple(rel1) assert '&' == op assert ('b', '!=', 2) == tuple(rel2)
def test_operation_with_nested_brackets(self): result = InfixBoolQuery.parseString( "((a != 1) & (b != 2))", parseAll=True ) rel1, op, rel2 = result.AttribQuery assert ("a", "!=", 1) == tuple(rel1) assert "&" == op assert ("b", "!=", 2) == tuple(rel2)
def test_operation_with_nested_brackets(self): result = InfixBoolQuery.parseString('((a != 1) & (b != 2))', parseAll=True) rel1, op, rel2 = result.AttribQuery self.assertEqual(('a', '!=', 1), tuple(rel1)) self.assertEqual('&', op) self.assertEqual(('b', '!=', 2), tuple(rel2))
def test_not_operation_with_brackets(self): result = InfixBoolQuery.parseString('!(a!=1)', parseAll=True) op, relation = result.AttribQuery self.assertEqual('!', op) self.assertEqual(('a', '!=', 1), tuple(relation))
def test_or_operation(self): result = InfixBoolQuery.parseString('a != 1 | b != 2', parseAll=True) rel1, op, rel2 = result.AttribQuery self.assertEqual(('a', '!=', 1), tuple(rel1)) self.assertEqual('|', op) self.assertEqual(('b', '!=', 2), tuple(rel2))
def test_not_operation(self): result = InfixBoolQuery.parseString('!a!=1', parseAll=True) op, relation = result.AttribQuery self.assertEqual('!', op) self.assertEqual(('a', '!=', 1), tuple(relation))
def test_not_operation_with_brackets(self): result = InfixBoolQuery.parseString('!(a!=1)', parseAll=True) op, relation = result.AttribQuery assert '!' == op assert ('a', '!=', 1) == tuple(relation)
def test_or_operation(self): result = InfixBoolQuery.parseString('a != 1 | b != 2', parseAll=True) rel1, op, rel2 = result.AttribQuery assert ('a', '!=', 1) == tuple(rel1) assert '|' == op assert ('b', '!=', 2) == tuple(rel2)
def test_not_operation_with_brackets(self): result = InfixBoolQuery.parseString("!(a!=1)", parseAll=True) op, relation = result.AttribQuery assert "!" == op assert ("a", "!=", 1) == tuple(relation)
def test_or_operation(self): result = InfixBoolQuery.parseString("a != 1 | b != 2", parseAll=True) rel1, op, rel2 = result.AttribQuery assert ("a", "!=", 1) == tuple(rel1) assert "|" == op assert ("b", "!=", 2) == tuple(rel2)