MCPcopy Create free account
hub / github.com/cdgriffith/Box / test_frozen

Method test_frozen

test/test_config_box_case.py:185–197  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

183 assert cb.to_dict() == {"SECTION": {"a": 1}}
184
185 def test_frozen(self):
186 cb = ConfigBox({"Host": "h", "host": "x"}, frozen_box=True)
187 assert cb.to_dict() == {"host": "x"}
188 assert cb.HOST == "x"
189 for action in (
190 lambda: cb.__setitem__("HOST", 1),
191 lambda: cb.update(HOST=1),
192 lambda: cb.merge_update(HOST=1),
193 lambda: cb.__delitem__("HOST"),
194 ):
195 with pytest.raises(BoxError):
196 action()
197 assert cb.to_dict() == {"host": "x"}
198
199 def test_copy_pickle_round_trip(self):
200 cb = ConfigBox({"Host": "h", "Nested": {"Key": 1}})

Callers

nothing calls this directly

Calls 6

__setitem__Method · 0.95
updateMethod · 0.95
merge_updateMethod · 0.95
__delitem__Method · 0.95
ConfigBoxClass · 0.90
to_dictMethod · 0.80

Tested by

no test coverage detected