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

Method test_setdefault_dots

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

Source from the content-addressed store, hash-verified

1634 assert box["f"][1] == 2
1635
1636 def test_setdefault_dots(self):
1637 box = Box({"a": 1}, box_dots=True)
1638 box.setdefault("b", 2)
1639 box.c = {"d": 3}
1640 box.setdefault("c.e", "test")
1641 box.setdefault("d", {"e": True})
1642 box.setdefault("f", [1, 2])
1643
1644 assert box.b == 2
1645 assert box.c.e == "test"
1646 assert isinstance(box["d"], Box)
1647 assert box.d.e == True # noqa: E712
1648 assert isinstance(box["f"], BoxList)
1649 assert box.f[1] == 2
1650
1651 def test_setdefault_dots_default(self):
1652 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