示例#1
0
 def register_hooks(self):
     for attr in dir(self):
         attr = getattr(self, attr)
         eventname = getattr(attr, 'handled_event', None)
         if eventname:
             event.register(eventname, attr)
示例#2
0
def test_event_register():
    event.register('test-cb', _callback)
    callbacks = event.get_events()
    assert 'test-cb' in callbacks
    assert _callback in callbacks['test-cb'] 
示例#3
0
def test_event_register():
    event.register('test-cb', _callback)
    callbacks = event.get_events()
    assert 'test-cb' in callbacks
    assert _callback in callbacks['test-cb']
示例#4
0
 def register_hooks(self):
     for attr in dir(self):
         attr = getattr(self, attr)
         eventname = getattr(attr, 'handled_event', None)
         if eventname:
             event.register(eventname, attr)