예제 #1
0
 def testeval(obj=None, expected_result=None):
     assert evaluator(obj) == expected_result, "%s != %r for %s with %r" % (
         evaluator(obj),
         expected_result,
         clause,
         obj,
     )
예제 #2
0
 def testeval(obj=None, expected_result=None):
     assert evaluator(obj) == expected_result, "%s != %r for %s with %r" % (
         evaluator(obj),
         expected_result,
         clause,
         obj,
     )
예제 #3
0
    def test_mulitple_expressions(self):
        User = self.classes.User

        evaluator = compiler.process(User.id > 5, User.name == "ed")

        is_(evaluator(User(id=7, name="ed")), True)
        is_(evaluator(User(id=7, name="noted")), False)
        is_(evaluator(User(id=4, name="ed")), False)