| 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) |