def test_parse_dictionary(self): r = parse_dictionary({'username': '******', 'prog': '!= 5'}, self.model) self.assertEqual(type(r), list) self.assertTrue(len(r) == 2) expected_expression = sqla_op.eq(self.model.username, 'john') any_true = any(expected_expression.compare(elem) for elem in r) self.assertTrue(any_true) expected_expression = sqla_op.ne(self.model.prog, 5) any_true = any(expected_expression.compare(elem) for elem in r) self.assertTrue(any_true)
def test_not_eq(self): expected_expression = sqla_op.ne(self.model.prog, 5) r = parse('prog != 5', self.model) self.assertEqual(type(r), list) self.assertTrue(len(r) == 1) self.assertTrue(expected_expression.compare(r[0]))