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

Method test_create_subdicts

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

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 2

to_dictMethod · 0.95
BoxClass · 0.90

Tested by

no test coverage detected