Exemple #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')
Exemple #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()
Exemple #3
0
 def events(self):
     '''Events for the application: ``ready```, ``start``, ``stop``.'''
     return EventHandler(one_time_events=('ready', 'start', 'stop'))