mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
Issue #6477: Added support for pickling the types of built-in singletons.
This commit is contained in:
parent
f8ceb04fcf
commit
19b6fa6ebb
6 changed files with 58 additions and 4 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue