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

Method test_setdefault_dots

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

Source from the content-addressed store, hash-verified

1350 assert box["f"][1] == 2
1351
1352 def test_setdefault_dots(self):
1353 box = Box({"a": 1}, box_dots=True)
1354 box.setdefault("b", 2)
1355 box.c = {"d": 3}
1356 box.setdefault("c.e", "test")
1357 box.setdefault("d", {"e": True})
1358 box.setdefault("f", [1, 2])
1359
1360 assert box.b == 2
1361 assert box.c.e == "test"
1362 assert isinstance(box["d"], Box)
1363 assert box.d.e == True
1364 assert isinstance(box["f"], BoxList)
1365 assert box.f[1] == 2
1366
1367 def test_setdefault_dots_default(self):
1368 box = Box({"a": 1}, box_dots=True, default_box=True)

Callers

nothing calls this directly

Calls 2

setdefaultMethod · 0.95
BoxClass · 0.90

Tested by

no test coverage detected