readonly also prevents deletion

This commit is contained in:
Jakob Ketterl
2021-03-20 00:54:45 +01:00
parent c50473fea5
commit c58ebfa657
2 changed files with 11 additions and 0 deletions

View File

@ -13,3 +13,11 @@ class PropertyReadOnlyTest(TestCase):
ro["otherkey"] = "testvalue"
self.assertEqual(ro["testkey"], "initial value")
self.assertNotIn("otherkey", ro)
def testPreventsDeletes(self):
layer = PropertyLayer(testkey="some value")
ro = PropertyReadOnly(layer)
with self.assertRaises(PropertyWriteError):
del ro["testkey"]
self.assertEqual(ro["testkey"], "some value")
self.assertEqual(layer["testkey"], "some value")