https://github.com/python/cpython/commit/5de7e3f9739b01ad180fffb242ac57cea930e74d
commit: 5de7e3f9739b01ad180fffb242ac57cea930e74d
branch: main
author: sobolevn <[email protected]>
committer: sobolevn <[email protected]>
date: 2025-07-05T09:14:40+03:00
summary:
gh-136297: Test all `pickle` protocols in `test_zoneinfo_property.py` (#136298)
files:
M Lib/test/test_zoneinfo/test_zoneinfo_property.py
diff --git a/Lib/test/test_zoneinfo/test_zoneinfo_property.py
b/Lib/test/test_zoneinfo/test_zoneinfo_property.py
index feaa77f3e7f0b9..294c7e9b27a857 100644
--- a/Lib/test/test_zoneinfo/test_zoneinfo_property.py
+++ b/Lib/test/test_zoneinfo/test_zoneinfo_property.py
@@ -146,20 +146,24 @@ def setUp(self):
@add_key_examples
def test_pickle_unpickle_cache(self, key):
zi = self.klass(key)
- pkl_str = pickle.dumps(zi)
- zi_rt = pickle.loads(pkl_str)
+ for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+ with self.subTest(proto=proto):
+ pkl_str = pickle.dumps(zi, proto)
+ zi_rt = pickle.loads(pkl_str)
- self.assertIs(zi, zi_rt)
+ self.assertIs(zi, zi_rt)
@hypothesis.given(key=valid_keys())
@add_key_examples
def test_pickle_unpickle_no_cache(self, key):
zi = self.klass.no_cache(key)
- pkl_str = pickle.dumps(zi)
- zi_rt = pickle.loads(pkl_str)
+ for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+ with self.subTest(proto=proto):
+ pkl_str = pickle.dumps(zi, proto)
+ zi_rt = pickle.loads(pkl_str)
- self.assertIsNot(zi, zi_rt)
- self.assertEqual(str(zi), str(zi_rt))
+ self.assertIsNot(zi, zi_rt)
+ self.assertEqual(str(zi), str(zi_rt))
@hypothesis.given(key=valid_keys())
@add_key_examples
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]