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

Method test_set_default

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

Source from the content-addressed store, hash-verified

309 assert a.key3.yy == 8
310
311 def test_set_default(self):
312 a = Box(test_dict)
313
314 new = a.setdefault("key3", {"item": 2})
315 new_list = a.setdefault("lister", [{"gah": 7}])
316 assert a.setdefault("key1", False) == "value1"
317
318 assert new == Box(item=2)
319 assert new_list == BoxList([{"gah": 7}])
320 assert a.key3.item == 2
321 assert a.lister[0].gah == 7
322
323 def test_set_default_box_dots(self):
324 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