diff options
| author | Guido van Rossum <guido@dropbox.com> | 2015-11-19 16:16:52 (GMT) |
|---|---|---|
| committer | Guido van Rossum <guido@dropbox.com> | 2015-11-19 16:16:52 (GMT) |
| commit | 1b2bd70f98a24bbf69939fbddcb7a52d923d18aa (patch) | |
| tree | 01b190fbf58f419bdb6e2478b368d1b037fe637c /Lib/test/test_typing.py | |
| parent | ca0f0a6badce6ab66d0b1e2323d3ecc59cb02f6c (diff) | |
| parent | 557d1eb0f3ccb9b0bea685a1883dd249cbe6d23a (diff) | |
| download | cpython-1b2bd70f98a24bbf69939fbddcb7a52d923d18aa.zip cpython-1b2bd70f98a24bbf69939fbddcb7a52d923d18aa.tar.gz cpython-1b2bd70f98a24bbf69939fbddcb7a52d923d18aa.tar.bz2 | |
Issue #25665: Make NamedTuple picklable. (Merge 3.5->3.6)
Diffstat (limited to 'Lib/test/test_typing.py')
| -rw-r--r-- | Lib/test/test_typing.py | 8 |
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): |
