def test_cancel_resets_stop_variable(self): m = mock.Mock() h = handler.handler() h.chain(m) h.stop_propagation() h.cancel() self.assertFalse(h.stop)
def test_cancel_does_not_invoke_handlers_if_stop_is_set(self): m = mock.Mock() h = handler.handler() h.chain(m) h.stop_propagation() h.cancel() self.assertEqual(0, m.cancel.call_count)
def test_unhandle_call_all_handlers(self): m = mock.Mock() h = handler.handler() h.chain(m) h.unhandle() m.unhandle.assert_called_with()
def test_cancel_call_all_handlers(self): m = mock.Mock() h = handler.handler() h.chain(m) h.cancel() m.cancel.assert_called_with()
def test_chain_extends_handlers(self): h = handler.handler() h.chain("foo", "bar") self.assertEqual(["foo", "bar"], h.handlers)
def test_chain_returns_self(self): h = handler.handler() self.assertEqual(h, h.chain("foo", "bar"))