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

Method test_setdefault_dots_default

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

Source from the content-addressed store, hash-verified

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)
1369 box.b.c.d.setdefault("e", 2)
1370 box.c.setdefault("e", "test")
1371 box.d.e.setdefault("f", {"g": True})
1372 box.e.setdefault("f", [1, 2])
1373
1374 assert box["b.c.d"].e == 2
1375 assert box.c.e == "test"
1376 assert isinstance(box["d.e.f"], Box)
1377 assert box.d.e["f.g"] is True
1378 assert isinstance(box["e.f"], BoxList)
1379 assert box.e.f[1] == 2
1380
1381 def test_box_slice(self):
1382 data = Box(qwe=123, asd=234, q=1)

Callers

nothing calls this directly

Calls 2

BoxClass · 0.90
setdefaultMethod · 0.80

Tested by

no test coverage detected