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

Method test_set_default

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

Source from the content-addressed store, hash-verified

387 assert a.key3.yy == 8
388
389 def test_set_default(self):
390 a = Box(test_dict)
391
392 new = a.setdefault("key3", {"item": 2})
393 new_list = a.setdefault("lister", [{"gah": 7}])
394 assert a.setdefault("key1", False) == "value1"
395
396 assert new == Box(item=2)
397 assert new_list == BoxList([{"gah": 7}])
398 assert a.key3.item == 2
399 assert a.lister[0].gah == 7
400
401 def test_set_default_box_dots(self):
402 a = Box(box_dots=True)

Callers

nothing calls this directly

Calls 3

setdefaultMethod · 0.95
BoxClass · 0.90
BoxListClass · 0.90

Tested by

no test coverage detected