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

Method test_get

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

Source from the content-addressed store, hash-verified

1066 Box(box_dots=False).items(dotted=True)
1067
1068 def test_get(self):
1069 bx = Box()
1070 bx["c"] = {}
1071 assert bx.get("a") is None
1072 assert isinstance(bx.get("c"), Box)
1073 assert isinstance(bx.get("b", {}), Box)
1074 assert "a" in bx.get("a", Box(a=1, conversion_box=False))
1075 assert isinstance(bx.get("a", [1, 2]), BoxList)
1076 bx_dot = Box(a=Box(b=Box(c="me!")), box_dots=True)
1077 assert bx_dot.get("a.b.c") == "me!"
1078 assert bx_dot.get("def.not.in.the.box", 4) == 4
1079
1080 def test_get_default_keeps_box_config(self):
1081 bx = Box(box_dots=True, default_box=True, camel_killer_box=True)

Callers

nothing calls this directly

Calls 2

getMethod · 0.95
BoxClass · 0.90

Tested by

no test coverage detected