summaryrefslogtreecommitdiffstats
path: root/Lib/test/pickletester.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2013-12-01 00:52:03 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2013-12-01 00:52:03 (GMT)
commita2934280e56dfca6ec74a6ce8392b5496592ab93 (patch)
tree72d18564704db9a850faf544169d5891c46ed77a /Lib/test/pickletester.py
parent34ca066d1c3cc5071713bad353688d18a54cc22b (diff)
downloadcpython-a2934280e56dfca6ec74a6ce8392b5496592ab93.zip
cpython-a2934280e56dfca6ec74a6ce8392b5496592ab93.tar.gz
cpython-a2934280e56dfca6ec74a6ce8392b5496592ab93.tar.bz2
Issue #6477: Added pickling support for singletons and their types.
Diffstat (limited to 'Lib/test/pickletester.py')
-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 1599893..d7b68db 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -661,6 +661,15 @@ class AbstractPickleTests(unittest.TestCase):
u = self.loads(s)
self.assertEqual(t, u)
+ def test_singleton_types(self):
+ # Issue #6477: Test that types of built-in singletons can be pickled.
+ singletons = [None, Ellipsis, 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):