summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_typing.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2015-11-19 16:16:31 (GMT)
committerGuido van Rossum <guido@python.org>2015-11-19 16:16:31 (GMT)
commit557d1eb0f3ccb9b0bea685a1883dd249cbe6d23a (patch)
treede8211868e4edc01eac2159a486a41b739a03285 /Lib/test/test_typing.py
parent05e3090e3a886b86e8b498247c43a14729ae571c (diff)
downloadcpython-557d1eb0f3ccb9b0bea685a1883dd249cbe6d23a.zip
cpython-557d1eb0f3ccb9b0bea685a1883dd249cbe6d23a.tar.gz
cpython-557d1eb0f3ccb9b0bea685a1883dd249cbe6d23a.tar.bz2
Issue #25665: Make NamedTuple picklable.
Diffstat (limited to 'Lib/test/test_typing.py')
-rw-r--r--Lib/test/test_typing.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index ae138c6..6ddaba9 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -1163,6 +1163,14 @@ class NamedTupleTests(TestCase):
assert Emp._fields == ('name', 'id')
assert Emp._field_types == dict(name=str, id=int)
+ def test_pickle(self):
+ global Emp # pickle wants to reference the class by name
+ Emp = NamedTuple('Emp', [('name', str), ('id', int)])
+ jane = Emp('jane', 37)
+ z = pickle.dumps(jane)
+ jane2 = pickle.loads(z)
+ assert jane == jane2
+
class IOTests(TestCase):