(self)
| 226 | Box(22, 33) |
| 227 | |
| 228 | def test_create_subdicts(self): |
| 229 | a = Box({"data": 2, "count": 5}) |
| 230 | a.brand_new = {"subdata": 1} |
| 231 | assert a.brand_new.subdata == 1 |
| 232 | a.new_list = [{"sub_list_item": 1}] |
| 233 | assert a.new_list[0].sub_list_item == 1 |
| 234 | assert isinstance(a.new_list, BoxList) |
| 235 | a.new_list2 = [[{"sub_list_item": 2}]] |
| 236 | assert a.new_list2[0][0].sub_list_item == 2 |
| 237 | b = a.to_dict() |
| 238 | assert not isinstance(b["new_list"], BoxList) |
| 239 | |
| 240 | def test_to_json_basic(self): |
| 241 | a = Box(test_dict) |