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

Method test_merge_update

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

Source from the content-addressed store, hash-verified

347 assert bx.to_dict() == {"keep": True}
348
349 def test_merge_update(self):
350 a = Box(test_dict)
351 a.grand = 1000
352 a.merge_update({"key1": {"new": 5}, "Key 2": {"add_key": 6}, "lister": ["a"]})
353 a.merge_update([("asdf", "fdsa")])
354 a.merge_update(testkey=66)
355 a.merge_update({"items": {"test": "pme"}})
356 a.merge_update({"key1": {"gg": 4}})
357 b = Box()
358 b.merge_update(item=1)
359 b.merge_update(E=4)
360 b.merge_update(__m=1)
361
362 assert a.grand == 1000
363 assert a["grand"] == 1000
364 assert isinstance(a["items"], Box)
365 assert a["items"].test == "pme"
366 assert a.key1.new == 5
367 assert a["Key 2"].add_key == 6
368 assert isinstance(a.key1, Box)
369 assert isinstance(a.lister, BoxList)
370 assert a.asdf == "fdsa"
371 assert a.testkey == 66
372 assert a.key1.new == 5
373 assert a.key1.gg == 4
374 with pytest.raises(ValueError):
375 b.merge_update("test")
376
377 def test_auto_attr(self):
378 a = Box(test_dict, default_box=True)

Callers

nothing calls this directly

Calls 2

merge_updateMethod · 0.95
BoxClass · 0.90

Tested by

no test coverage detected