MCPcopy Create free account
hub / github.com/LabPy/lantz / test_readonly

Method test_readonly

lantz/testsuite/test_dictfeat.py:45–58  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

43 )
44
45 def test_readonly(self):
46
47 class Spam(Driver):
48
49 _eggs = {'answer': 42}
50
51 @DictFeat()
52 def eggs(self_, key):
53 return self_._eggs[key]
54
55 obj = Spam()
56 self.assertEqual(obj.eggs['answer'], 42)
57 self.assertRaises(AttributeError, setattr, obj, "eggs", 3)
58 self.assertRaises(AttributeError, delattr, obj, "eggs")
59
60 def test_writeonly(self):
61

Callers

nothing calls this directly

Calls 1

SpamClass · 0.70

Tested by

no test coverage detected