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

Method test_update

test/test_box.py:244–269  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

242 assert "big_camel" in dir(a)
243
244 def test_update(self):
245 a = Box(test_dict)
246 a.grand = 1000
247 a.update({"key1": {"new": 5}, "Key 2": {"add_key": 6}, "lister": ["a"]})
248 a.update([("asdf", "fdsa")])
249 a.update(testkey=66)
250 a.update({"items": {"test": "pme"}})
251 a.update({"key1": {"gg": 4}})
252 b = Box()
253 b.update(item=1)
254 b.update(E=1)
255 b.update(__m=1)
256 with pytest.raises(ValueError):
257 b.update("test")
258
259 assert a.grand == 1000
260 assert a["grand"] == 1000
261 assert isinstance(a["items"], Box)
262 assert a["items"].test == "pme"
263 assert a["Key 2"].add_key == 6
264 assert isinstance(a.key1, Box)
265 assert isinstance(a.lister, BoxList)
266 assert a.asdf == "fdsa"
267 assert a.testkey == 66
268 assert a.key1.gg == 4
269 assert "new" not in a.key1.keys()
270
271 def test_merge_update(self):
272 a = Box(test_dict)

Callers

nothing calls this directly

Calls 3

updateMethod · 0.95
BoxClass · 0.90
keysMethod · 0.80

Tested by

no test coverage detected