Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
    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)