diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2022-01-16 04:33:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-16 04:33:28 (GMT) |
commit | 37eab55ac9da6b6361f136a1da15bfcef12ed954 (patch) | |
tree | c61ab48f9eff9114e4454ee28bbf58ca0e8eedce /Lib | |
parent | 0a28118324f64851b684ec3afdd063c47513a236 (diff) | |
download | cpython-37eab55ac9da6b6361f136a1da15bfcef12ed954.zip cpython-37eab55ac9da6b6361f136a1da15bfcef12ed954.tar.gz cpython-37eab55ac9da6b6361f136a1da15bfcef12ed954.tar.bz2 |
bpo-46387: test all pickle protos in `test_field_descriptor` in `test_collections` (GH-30614)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_collections.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 48327bf..3a16045 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -677,14 +677,16 @@ class TestNamedTuple(unittest.TestCase): 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', ()) |