(self)
| 448 | assert a.lister[0].gah == 7 |
| 449 | |
| 450 | def test_set_default_box_dots(self): |
| 451 | a = Box(box_dots=True) |
| 452 | a["x"] = {"y": 10} |
| 453 | a.setdefault("x.y", 20) |
| 454 | assert a["x.y"] == 10 |
| 455 | |
| 456 | a["lists"] = [[[{"test": "here"}], {1, 2}], (4, 5)] |
| 457 | assert list(_get_dot_paths(a)) == [ |
| 458 | "x", |
| 459 | "x.y", |
| 460 | "lists", |
| 461 | "lists[0]", |
| 462 | "lists[0][0]", |
| 463 | "lists[0][0][0]", |
| 464 | "lists[0][0][0].test", |
| 465 | "lists[0][1]", |
| 466 | "lists[1]", |
| 467 | ] |
| 468 | |
| 469 | t = Box({"a": 1}, default_box=True, box_dots=True, default_box_none_transform=False) |
| 470 | assert t.setdefault("b", [1, 2]) == [1, 2] |
| 471 | assert t == Box(a=1, b=[1, 2]) |
| 472 | assert t.setdefault("c", [{"d": 2}]) == BoxList([{"d": 2}]) |
| 473 | |
| 474 | def test_from_json_file(self): |
| 475 | bx = Box.from_json(filename=data_json_file) |
nothing calls this directly
no test coverage detected