add a test that makes sure that writing to a filtered property fails
This commit is contained in:
parent
862a251295
commit
8b52988dcd
@ -11,7 +11,7 @@ class PropertyFilterTest(TestCase):
|
|||||||
pf = PropertyFilter(pm, "testkey")
|
pf = PropertyFilter(pm, "testkey")
|
||||||
self.assertEqual(pf["testkey"], "testvalue")
|
self.assertEqual(pf["testkey"], "testvalue")
|
||||||
|
|
||||||
def testMissesPropert(self):
|
def testMissesProperty(self):
|
||||||
pm = PropertyLayer()
|
pm = PropertyLayer()
|
||||||
pm["testkey"] = "testvalue"
|
pm["testkey"] = "testvalue"
|
||||||
pf = PropertyFilter(pm, "other_key")
|
pf = PropertyFilter(pm, "other_key")
|
||||||
@ -49,3 +49,11 @@ class PropertyFilterTest(TestCase):
|
|||||||
pf["testkey"] = "new value"
|
pf["testkey"] = "new value"
|
||||||
self.assertEqual(pm["testkey"], "new value")
|
self.assertEqual(pm["testkey"], "new value")
|
||||||
self.assertEqual(pf["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")
|
||||||
|
Loading…
Reference in New Issue
Block a user