From 8b52988dcd81159b87b19d535882efdc16c5709d Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sun, 24 Jan 2021 20:15:02 +0100 Subject: [PATCH] add a test that makes sure that writing to a filtered property fails --- test/property/test_property_filter.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/property/test_property_filter.py b/test/property/test_property_filter.py index 66eff3b..8553552 100644 --- a/test/property/test_property_filter.py +++ b/test/property/test_property_filter.py @@ -11,7 +11,7 @@ class PropertyFilterTest(TestCase): pf = PropertyFilter(pm, "testkey") self.assertEqual(pf["testkey"], "testvalue") - def testMissesPropert(self): + def testMissesProperty(self): pm = PropertyLayer() pm["testkey"] = "testvalue" pf = PropertyFilter(pm, "other_key") @@ -49,3 +49,11 @@ class PropertyFilterTest(TestCase): pf["testkey"] = "new value" self.assertEqual(pm["testkey"], "new value") self.assertEqual(pf["testkey"], "new value") + + def testRejectsWrite(self): + pm = PropertyLayer() + pm["testkey"] = "old value" + pf = PropertyFilter(pm, "otherkey") + with self.assertRaises(KeyError): + pf["testkey"] = "new value" + self.assertEqual(pm["testkey"], "old value")