mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
bpo-46387: test all pickle protos in test_field_descriptor in test_collections (GH-30614)
This commit is contained in:
parent
0a28118324
commit
37eab55ac9
1 changed files with 8 additions and 6 deletions
|
|
@ -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', ())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue