Exemplo n.º 1
0
 def testUnregisterIfNotRegistered(self):
     """EventManager.unregister complains if not registered."""
     event_manager = EventManager()
     listener = SubListener()
     self.assertRaises(NotRegisteredError,
                       event_manager.unregister, listener)
     event_manager.register(listener)
     event_manager.unregister(listener)
     self.assertRaises(NotRegisteredError,
                       event_manager.unregister, listener)
Exemplo n.º 2
0
 def testUnregisterIfNotRegistered(self):
     """EventManager.unregister complains if not registered."""
     event_manager = EventManager()
     listener = SubListener()
     self.assertRaises(NotRegisteredError, event_manager.unregister,
                       listener)
     event_manager.register(listener)
     event_manager.unregister(listener)
     self.assertRaises(NotRegisteredError, event_manager.unregister,
                       listener)
Exemplo n.º 3
0
 def testUnregister(self):
     """EventManager.unregister removes the handlers of a listener."""
     event_manager = EventManager()
     listener1 = SubListener()
     listener2 = SubListener()
     event_manager.register(listener1)
     event_manager.register(listener2)
     event_manager.unregister(listener1)
     self.assertFalse(listener1 in event_manager._handlers['SubEvent'])
     self.assertTrue(listener2 in event_manager._handlers['SubEvent'])
Exemplo n.º 4
0
 def testUnregister(self):
     """EventManager.unregister removes the handlers of a listener."""
     event_manager = EventManager()
     listener1 = SubListener()
     listener2 = SubListener()
     event_manager.register(listener1)
     event_manager.register(listener2)
     event_manager.unregister(listener1)
     self.assertFalse(listener1 in event_manager._handlers['SubEvent'])
     self.assertTrue(listener2 in event_manager._handlers['SubEvent'])