def check_modified(self, code, output): parsed = parser.parse(code) self.assertEqual(output, str(parsed))
def variables(self, condition, event_vars, loose_vars): rule = "(%s)->(new x);" % condition strategy = parser.parse(rule); result = strategy.rules[0].variables() self.assertEqual(result, (set(event_vars), set(loose_vars)))
def check(self, code): parsed = parser.parse(code) self.assertEqual(code, str(parsed))
def evaluate(self, condition, expected, **kwargs): context = kwargs.get("context", {}) rule = "(%s)->(new x);" % condition strategy = parser.parse(rule); result = strategy.rules[0].conditions[0].evaluate(**context) self.assertEqual(result, expected)
def variables(self, condition, event_vars, loose_vars): rule = "(%s)->(new x);" % condition strategy = parser.parse(rule) result = strategy.rules[0].variables() self.assertEqual(result, (set(event_vars), set(loose_vars)))
def evaluate(self, condition, expected, **kwargs): context = kwargs.get("context", {}) rule = "(%s)->(new x);" % condition strategy = parser.parse(rule) result = strategy.rules[0].conditions[0].evaluate(**context) self.assertEqual(result, expected)