handle deletions correctly

This commit is contained in:
Jakob Ketterl
2021-03-06 23:48:31 +01:00
parent e0985c3802
commit 161408dbf4
2 changed files with 16 additions and 3 deletions

View File

@ -215,3 +215,14 @@ class PropertyStackTest(TestCase):
ps.wire(mock.method)
del low_pm["testkey"]
mock.method.assert_called_once_with({"testkey": PropertyDeleted})
def testChangeEventWhenKeyDeleted(self):
ps = PropertyStack()
low_pm = PropertyLayer(testkey="lowvalue")
high_pm = PropertyLayer(testkey="highvalue")
ps.addLayer(0, high_pm)
ps.addLayer(1, low_pm)
mock = Mock()
ps.wire(mock.method)
del high_pm["testkey"]
mock.method.assert_called_once_with({"testkey": "lowvalue"})