(self)
| 275 | Box(22, 33) |
| 276 | |
| 277 | def test_create_subdicts(self): |
| 278 | a = Box({"data": 2, "count": 5}) |
| 279 | a.brand_new = {"subdata": 1} |
| 280 | assert a.brand_new.subdata == 1 |
| 281 | a.new_list = [{"sub_list_item": 1}] |
| 282 | assert a.new_list[0].sub_list_item == 1 |
| 283 | assert isinstance(a.new_list, BoxList) |
| 284 | a.new_list2 = [[{"sub_list_item": 2}]] |
| 285 | assert a.new_list2[0][0].sub_list_item == 2 |
| 286 | b = a.to_dict() |
| 287 | assert not isinstance(b["new_list"], BoxList) |
| 288 | |
| 289 | def test_to_json_basic(self): |
| 290 | a = Box(test_dict) |