mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-36068: Make _tuplegetter objects serializable (GH-11981)
This commit is contained in:
parent
407c734326
commit
f36f89257b
3 changed files with 23 additions and 3 deletions
|
@ -13,7 +13,7 @@ from test import support
|
|||
import types
|
||||
import unittest
|
||||
|
||||
from collections import namedtuple, Counter, OrderedDict, _count_elements
|
||||
from collections import namedtuple, Counter, OrderedDict, _count_elements, _tuplegetter
|
||||
from collections import UserDict, UserString, UserList
|
||||
from collections import ChainMap
|
||||
from collections import deque
|
||||
|
@ -573,6 +573,15 @@ 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))
|
||||
|
||||
np = NewPoint([1, 2])
|
||||
|
||||
self.assertEqual(np.x, 1)
|
||||
self.assertEqual(np.y, 2)
|
||||
|
||||
|
||||
################################################################################
|
||||
### Abstract Base Classes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue