예제 #1
0
 def test_one_time(self):
     h = EventHandler(one_time_events=('start', 'finish'))
     self.assertEqual(h.event('finish').name, 'finish')
     h.bind_event('finish', lambda f: 'OK')
     result = h.fire_event('finish')
     self.assertTrue(h.event('finish').done())
     self.assertEqual(result, 'OK')
예제 #2
0
 def test_one_time_error(self):
     h = EventHandler(one_time_events=('start', 'finish'))
     self.assertEqual(h.event('finish').name, 'finish')
     h.bind_event('finish', lambda f: 'OK'+4)
     result = h.fire_event('finish')
     self.assertTrue(h.event('finish').done())
     self.assertTrue(isinstance(result, Failure))
     result.mute()
예제 #3
0
파일: __init__.py 프로젝트: japaks/pulsar
 def events(self):
     '''Events for the application: ``ready```, ``start``, ``stop``.'''
     return EventHandler(one_time_events=('ready', 'start', 'stop'))