[3.14] gh-136297: Fix hypothesis and subTest usage in test_zoneinfo_property.py (GH-136384) (#136407)

gh-136297: Fix `hypothesis` and `subTest` usage in `test_zoneinfo_property.py` (GH-136384)
(cherry picked from commit db699db99d)

Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2025-07-08 10:16:51 +02:00 committed by GitHub
parent 3296d9bcfd
commit 145c08629b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 10 deletions

View file

@ -147,23 +147,21 @@ def setUp(self):
def test_pickle_unpickle_cache(self, key):
zi = self.klass(key)
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)
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)
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)
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