def test_undo_notify_exception(monkeypatch): notif_mock = MagicMock() monkeypatch.setattr(Action, "notify", notif_mock) action = Action(None, MagicMock(side_effect=Exception)) try: action.undo() except Exception: pass assert notif_mock.call_count == 2
def test_undo_notify(monkeypatch): notif_mock = MagicMock() monkeypatch.setattr(Action, "notify", notif_mock) action = Action(None, MagicMock()) action.undo() assert notif_mock.call_count == 2