| 170 | |
| 171 | |
| 172 | class TestBoxListPickleFormats: |
| 173 | def test_loads_box_7_pickles(self, monkeypatch): |
| 174 | import pickle |
| 175 | |
| 176 | # Box 7 had no __reduce_ex__: items were appended first, then the instance state restored |
| 177 | with monkeypatch.context() as patch: |
| 178 | patch.delattr(BoxList, "__reduce_ex__") |
| 179 | data = pickle.dumps(BoxList([1, {"a": 1}], box_dots=True), protocol=2) |
| 180 | out = pickle.loads(data) |
| 181 | assert type(out) is BoxList |
| 182 | assert out.to_list() == [1, {"a": 1}] |
| 183 | assert out.box_options["box_dots"] is True |
| 184 | |
| 185 | def test_self_referencing_items_survive_pickle(self): |
| 186 | import pickle |
| 187 | |
| 188 | bl = BoxList([{"a": 1}]) |
| 189 | bl[0].parent = bl |
| 190 | out = pickle.loads(pickle.dumps(bl)) |
| 191 | assert out[0].parent is out |
| 192 | |
| 193 | |
| 194 | class TestConfigBoxPaths: |
nothing calls this directly
no outgoing calls
no test coverage detected