MCPcopy Create free account
hub / github.com/cdgriffith/Box / test_create_subdicts

Method test_create_subdicts

test/test_box.py:277–287  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 2

to_dictMethod · 0.95
BoxClass · 0.90

Tested by

no test coverage detected