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

Method test_set_default

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

Source from the content-addressed store, hash-verified

436 assert a.key3.yy == 8
437
438 def test_set_default(self):
439 a = Box(test_dict)
440
441 new = a.setdefault("key3", {"item": 2})
442 new_list = a.setdefault("lister", [{"gah": 7}])
443 assert a.setdefault("key1", False) == "value1"
444
445 assert new == Box(item=2)
446 assert new_list == BoxList([{"gah": 7}])
447 assert a.key3.item == 2
448 assert a.lister[0].gah == 7
449
450 def test_set_default_box_dots(self):
451 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