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

Method test_get

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

Source from the content-addressed store, hash-verified

755 Box(box_dots=False).items(dotted=True)
756
757 def test_get(self):
758 bx = Box()
759 bx["c"] = {}
760 assert bx.get("a") is None
761 assert isinstance(bx.get("c"), Box)
762 assert isinstance(bx.get("b", {}), Box)
763 assert "a" in bx.get("a", Box(a=1, conversion_box=False))
764 assert isinstance(bx.get("a", [1, 2]), BoxList)
765 bx_dot = Box(a=Box(b=Box(c="me!")), box_dots=True)
766 assert bx_dot.get("a.b.c") == "me!"
767 assert bx_dot.get("def.not.in.the.box", 4) == 4
768
769 def test_contains(self):
770 bx_dot = Box(a=Box(b=Box(c=Box())), box_dots=True)

Callers

nothing calls this directly

Calls 2

getMethod · 0.95
BoxClass · 0.90

Tested by

no test coverage detected