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

Method test_update

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

Source from the content-addressed store, hash-verified

279 assert "big_camel" in dir(a)
280
281 def test_update(self):
282 a = Box(test_dict)
283 a.grand = 1000
284 a.update({"key1": {"new": 5}, "Key 2": {"add_key": 6}, "lister": ["a"]})
285 a.update([("asdf", "fdsa")])
286 a.update(testkey=66)
287 a.update({"items": {"test": "pme"}})
288 a.update({"key1": {"gg": 4}})
289 b = Box()
290 b.update(item=1)
291 b.update(E=1)
292 b.update(__m=1)
293 with pytest.raises(ValueError):
294 b.update("test")
295
296 assert a.grand == 1000
297 assert a["grand"] == 1000
298 assert isinstance(a["items"], Box)
299 assert a["items"].test == "pme"
300 assert a["Key 2"].add_key == 6
301 assert isinstance(a.key1, Box)
302 assert isinstance(a.lister, BoxList)
303 assert a.asdf == "fdsa"
304 assert a.testkey == 66
305 assert a.key1.gg == 4
306 assert "new" not in a.key1.keys()
307
308 @pytest.mark.parametrize("source_type", [dict, list, iter])
309 def test_update_source_and_keywords(self, source_type):

Callers

nothing calls this directly

Calls 3

updateMethod · 0.95
BoxClass · 0.90
keysMethod · 0.80

Tested by

no test coverage detected