Issue #6477: Added support for pickling the types of built-in singletons.

This commit is contained in:
Alexandre Vassalotti 2013-11-30 16:06:39 -08:00
parent f8ceb04fcf
commit 19b6fa6ebb
6 changed files with 58 additions and 4 deletions

View file

@ -768,6 +768,15 @@ class AbstractPickleTests(unittest.TestCase):
u = self.loads(s)
self.assertEqual(NotImplemented, u)
def test_singleton_types(self):
# Issue #6477: Test that types of built-in singletons can be pickled.
singletons = [None, ..., NotImplemented]
for singleton in singletons:
for proto in protocols:
s = self.dumps(type(singleton), proto)
u = self.loads(s)
self.assertIs(type(singleton), u)
# Tests for protocol 2
def test_proto(self):