mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-44712: Replace "type(literal)" with corresponding builtin types (GH-27294)
I suppose it is a remnants of very old code written when str, int, list, dict, etc were functions and not classes.
This commit is contained in:
parent
c826867b7c
commit
3680ebed7f
19 changed files with 41 additions and 39 deletions
|
@ -6,6 +6,9 @@ from test.pickletester import ExtensionSaver
|
|||
class C:
|
||||
pass
|
||||
|
||||
def pickle_C(c):
|
||||
return C, ()
|
||||
|
||||
|
||||
class WithoutSlots(object):
|
||||
pass
|
||||
|
@ -32,16 +35,15 @@ class WithInherited(WithSingleString):
|
|||
class CopyRegTestCase(unittest.TestCase):
|
||||
|
||||
def test_class(self):
|
||||
self.assertRaises(TypeError, copyreg.pickle,
|
||||
C, None, None)
|
||||
copyreg.pickle(C, pickle_C)
|
||||
|
||||
def test_noncallable_reduce(self):
|
||||
self.assertRaises(TypeError, copyreg.pickle,
|
||||
type(1), "not a callable")
|
||||
C, "not a callable")
|
||||
|
||||
def test_noncallable_constructor(self):
|
||||
self.assertRaises(TypeError, copyreg.pickle,
|
||||
type(1), int, "not a callable")
|
||||
C, pickle_C, "not a callable")
|
||||
|
||||
def test_bool(self):
|
||||
import copy
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue