| 1017 | Box(box_dots=False).items(dotted=True) |
| 1018 | |
| 1019 | def test_get(self): |
| 1020 | bx = Box() |
| 1021 | bx["c"] = {} |
| 1022 | assert bx.get("a") is None |
| 1023 | assert isinstance(bx.get("c"), Box) |
| 1024 | assert isinstance(bx.get("b", {}), Box) |
| 1025 | assert "a" in bx.get("a", Box(a=1, conversion_box=False)) |
| 1026 | assert isinstance(bx.get("a", [1, 2]), BoxList) |
| 1027 | bx_dot = Box(a=Box(b=Box(c="me!")), box_dots=True) |
| 1028 | assert bx_dot.get("a.b.c") == "me!" |
| 1029 | assert bx_dot.get("def.not.in.the.box", 4) == 4 |
| 1030 | |
| 1031 | def test_contains(self): |
| 1032 | bx_dot = Box(a=Box(b=Box(c=Box())), box_dots=True) |