def test_raise(self): obj = LambdaStr(lambda_str = 'ev: aaa', name = 'test_true') event = MockEvent() obj.begin(event) event = MockEvent() self.assertRaises(ValueError, obj, event) obj.end()
def test_standard(self): obj = LambdaStr(lambda_str = 'ev : True', name = 'test_true') event = MockEvent() obj.begin(event) self.assertTrue(callable(obj.func)) event = MockEvent() self.assertTrue(obj(event)) event = MockEvent() self.assertTrue(obj.event(event)) obj.end() self.assertIsNone(obj.func)