def testEvent(self): event = Event() called_list = [] def test_listener(x): called_list.append(x) event += test_listener event(True) self.assertTrue(True in called_list) del called_list[:] event -= test_listener event.fire(True) self.assertTrue(True not in called_list)
def testEvent(self): event = Event() called_list = [] def test_listener(x): called_list.append(x) event += test_listener event(True) self.assertTrue(True in called_list) # test getHandlerCount data = event.getHandlerCount() self.assertEqual(1, data) del called_list[:] event -= test_listener event.fire(True) self.assertTrue(True not in called_list) self.assertRaises(ValueError, event.unhandle, test_listener) # test lines 35-36