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

Method test_setdefault_dots

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

Source from the content-addressed store, hash-verified

1699 assert box["f"][1] == 2
1700
1701 def test_setdefault_dots(self):
1702 box = Box({"a": 1}, box_dots=True)
1703 box.setdefault("b", 2)
1704 box.c = {"d": 3}
1705 box.setdefault("c.e", "test")
1706 box.setdefault("d", {"e": True})
1707 box.setdefault("f", [1, 2])
1708
1709 assert box.b == 2
1710 assert box.c.e == "test"
1711 assert isinstance(box["d"], Box)
1712 assert box.d.e == True # noqa: E712
1713 assert isinstance(box["f"], BoxList)
1714 assert box.f[1] == 2
1715
1716 def test_setdefault_dots_default(self):
1717 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