[Python-checkins] bpo-46387: test all pickle protos in `test_field_descriptor` in `test_collections` (GH-30614)
rhettinger
webhook-mailer at python.org
Sat Jan 15 23:33:39 EST 2022
https://github.com/python/cpython/commit/37eab55ac9da6b6361f136a1da15bfcef12ed954
commit: 37eab55ac9da6b6361f136a1da15bfcef12ed954
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: rhettinger <rhettinger at users.noreply.github.com>
date: 2022-01-15T22:33:28-06:00
summary:
bpo-46387: test all pickle protos in `test_field_descriptor` in `test_collections` (GH-30614)
files:
M Lib/test/test_collections.py
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 48327bf50ea42..3a16045c5aa1a 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -677,14 +677,16 @@ def test_field_descriptor(self):
self.assertRaises(AttributeError, Point.x.__set__, p, 33)
self.assertRaises(AttributeError, Point.x.__delete__, p)
- class NewPoint(tuple):
- x = pickle.loads(pickle.dumps(Point.x))
- y = pickle.loads(pickle.dumps(Point.y))
+ for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+ with self.subTest(proto=proto):
+ class NewPoint(tuple):
+ x = pickle.loads(pickle.dumps(Point.x, proto))
+ y = pickle.loads(pickle.dumps(Point.y, proto))
- np = NewPoint([1, 2])
+ np = NewPoint([1, 2])
- self.assertEqual(np.x, 1)
- self.assertEqual(np.y, 2)
+ self.assertEqual(np.x, 1)
+ self.assertEqual(np.y, 2)
def test_new_builtins_issue_43102(self):
obj = namedtuple('C', ())
More information about the Python-checkins
mailing list