Skip to content

Commit 416a1b7

Browse files
committed
Move pickle tests to test_dict
1 parent 24d757a commit 416a1b7

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

Lib/test/pickletester.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,6 +2886,8 @@ def test_recursive_dict_and_inst(self):
28862886
self._test_recursive_collection_and_inst(dict.fromkeys, oldminproto=0)
28872887

28882888
def test_recursive_frozendict_and_inst(self):
2889+
if self.py_version < (3, 15):
2890+
self.skipTest('need frozendict')
28892891
self._test_recursive_collection_and_inst(frozendict.fromkeys, minprotocol=2)
28902892

28912893
def test_recursive_set_and_inst(self):
@@ -3100,15 +3102,6 @@ def test_float_format(self):
31003102
# make sure that floats are formatted locale independent with proto 0
31013103
self.assertEqual(self.dumps(1.2, 0)[0:3], b'F1.')
31023104

3103-
def test_frozendict(self):
3104-
for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
3105-
for fd in (
3106-
frozendict(),
3107-
frozendict(x=1, y=2),
3108-
):
3109-
p = self.dumps(fd, proto)
3110-
self.assert_is_copy(fd, self.loads(p))
3111-
31123105
def test_reduce(self):
31133106
for proto in protocols:
31143107
with self.subTest(proto=proto):

Lib/test/test_dict.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,15 @@ def __new__(self):
18251825
self.assertEqual(type(fd), DictSubclass)
18261826
self.assertEqual(created, frozendict(x=1))
18271827

1828+
def test_pickle(self):
1829+
for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
1830+
for fd in (
1831+
frozendict(),
1832+
frozendict(x=1, y=2),
1833+
):
1834+
p = pickle.dumps(fd, proto)
1835+
self.assert_is_copy(fd, pickle.loads(p))
1836+
18281837

18291838
if __name__ == "__main__":
18301839
unittest.main()

0 commit comments

Comments
 (0)