summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2013-12-01 00:06:39 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2013-12-01 00:06:39 (GMT)
commit19b6fa6ebb887e498437b4ae87d6e70b92b4742b (patch)
tree06c58ae3259eb7bead5356406c4fc7fefa0e34d9 /Lib/test
parentf8ceb04fcfb2fac63c832639442e69d8902a48b8 (diff)
downloadcpython-19b6fa6ebb887e498437b4ae87d6e70b92b4742b.zip
cpython-19b6fa6ebb887e498437b4ae87d6e70b92b4742b.tar.gz
cpython-19b6fa6ebb887e498437b4ae87d6e70b92b4742b.tar.bz2
Issue #6477: Added support for pickling the types of built-in singletons.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/pickletester.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 86869e1..86d668e 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -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):