(self)
| 321 | assert a.lister[0].gah == 7 |
| 322 | |
| 323 | def test_set_default_box_dots(self): |
| 324 | a = Box(box_dots=True) |
| 325 | a["x"] = {"y": 10} |
| 326 | a.setdefault("x.y", 20) |
| 327 | assert a["x.y"] == 10 |
| 328 | |
| 329 | a["lists"] = [[[{"test": "here"}], {1, 2}], (4, 5)] |
| 330 | assert list(_get_dot_paths(a)) == [ |
| 331 | "x", |
| 332 | "x.y", |
| 333 | "lists", |
| 334 | "lists[0]", |
| 335 | "lists[0][0]", |
| 336 | "lists[0][0][0]", |
| 337 | "lists[0][0][0].test", |
| 338 | "lists[0][1]", |
| 339 | "lists[1]", |
| 340 | ] |
| 341 | |
| 342 | t = Box({"a": 1}, default_box=True, box_dots=True, default_box_none_transform=False) |
| 343 | assert t.setdefault("b", [1, 2]) == [1, 2] |
| 344 | assert t == Box(a=1, b=[1, 2]) |
| 345 | assert t.setdefault("c", [{"d": 2}]) == BoxList([{"d": 2}]) |
| 346 | |
| 347 | def test_from_json_file(self): |
| 348 | bx = Box.from_json(filename=data_json_file) |
nothing calls this directly
no test coverage detected