From e7e5af9a53585886adba41225c1344836d6e0b28 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Mon, 12 Dec 2022 17:42:16 +0100 Subject: [PATCH] add a test for listener removal --- test/owrx/active/list/test_active_list.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/owrx/active/list/test_active_list.py b/test/owrx/active/list/test_active_list.py index 5cb7772..6a63dac 100644 --- a/test/owrx/active/list/test_active_list.py +++ b/test/owrx/active/list/test_active_list.py @@ -71,3 +71,14 @@ class ActiveListTest(TestCase): x = [m for m in list] self.assertEqual(len(x), 1) self.assertEqual(x[0], "initialvalue") + + def testListenerRemoval(self): + list = ActiveList(["initialvalue"]) + listenerMock = Mock() + list.addListener(listenerMock) + list[0] = "testvalue" + listenerMock.onIndexChanged.assert_called_once_with(0, "testvalue") + listenerMock.reset_mock() + list.removeListener(listenerMock) + list[0] = "someothervalue" + listenerMock.onIndexChanged.assert_not_called()