(self)
| 399 | assert a.lister[0].gah == 7 |
| 400 | |
| 401 | def test_set_default_box_dots(self): |
| 402 | a = Box(box_dots=True) |
| 403 | a["x"] = {"y": 10} |
| 404 | a.setdefault("x.y", 20) |
| 405 | assert a["x.y"] == 10 |
| 406 | |
| 407 | a["lists"] = [[[{"test": "here"}], {1, 2}], (4, 5)] |
| 408 | assert list(_get_dot_paths(a)) == [ |
| 409 | "x", |
| 410 | "x.y", |
| 411 | "lists", |
| 412 | "lists[0]", |
| 413 | "lists[0][0]", |
| 414 | "lists[0][0][0]", |
| 415 | "lists[0][0][0].test", |
| 416 | "lists[0][1]", |
| 417 | "lists[1]", |
| 418 | ] |
| 419 | |
| 420 | t = Box({"a": 1}, default_box=True, box_dots=True, default_box_none_transform=False) |
| 421 | assert t.setdefault("b", [1, 2]) == [1, 2] |
| 422 | assert t == Box(a=1, b=[1, 2]) |
| 423 | assert t.setdefault("c", [{"d": 2}]) == BoxList([{"d": 2}]) |
| 424 | |
| 425 | def test_from_json_file(self): |
| 426 | bx = Box.from_json(filename=data_json_file) |
nothing calls this directly
no test coverage detected