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

Method test_frozen_list

test/test_box_list.py:53–75  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

51 assert not isinstance(new_list.to_list(), BoxList)
52
53 def test_frozen_list(self):
54 bl = BoxList([5, 4, 3], frozen_box=True)
55 with pytest.raises(BoxError):
56 bl.pop(1)
57 with pytest.raises(BoxError):
58 bl.remove(4)
59 with pytest.raises(BoxError):
60 bl.sort()
61 with pytest.raises(BoxError):
62 bl.reverse()
63 with pytest.raises(BoxError):
64 bl.append("test")
65 with pytest.raises(BoxError):
66 bl.extend([4])
67 with pytest.raises(BoxError):
68 del bl[0]
69 with pytest.raises(BoxError):
70 bl[0] = 5
71 bl2 = BoxList([5, 4, 3])
72 del bl2[0]
73 assert bl2[0] == 4
74 bl2[1] = 4
75 assert bl2[1] == 4
76
77 def test_box_list_to_json(self):
78 bl = BoxList([{"item": 1, "CamelBad": 2}])

Callers

nothing calls this directly

Calls 4

appendMethod · 0.95
extendMethod · 0.95
BoxListClass · 0.90
popMethod · 0.80

Tested by

no test coverage detected