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

Method test_pickle

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

Source from the content-addressed store, hash-verified

938 my_box["g"]
939
940 def test_pickle(self):
941 if platform.python_implementation() == "PyPy":
942 pytest.skip("Pickling does not work correctly on PyPy")
943 pic_file = os.path.join(tmp_dir, "test.p")
944 pic2_file = os.path.join(tmp_dir, "test.p2")
945 bb = Box(movie_data, conversion_box=False)
946 pickle.dump(bb, open(pic_file, "wb"))
947 loaded = pickle.load(open(pic_file, "rb"))
948 assert bb == loaded
949 assert loaded._box_config["conversion_box"] is False
950
951 ll = [[Box({"a": "b"})], [[{"c": "g"}]]]
952 bx = BoxList(ll)
953 pickle.dump(bx, open(pic2_file, "wb"))
954 loaded2 = pickle.load(open(pic2_file, "rb"))
955 assert bx == loaded2
956 loaded2.box_options = bx.box_options
957
958 def test_pickle_preserves_subclass_on_nested_access(self):
959 if platform.python_implementation() == "PyPy":

Callers

nothing calls this directly

Calls 2

BoxClass · 0.90
BoxListClass · 0.90

Tested by

no test coverage detected