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:
Serhiy Storchaka 2022-05-08 17:10:11 +03:00 committed by GitHub
parent c826867b7c
commit 3680ebed7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 41 additions and 39 deletions

View file

@ -426,7 +426,7 @@ class ClassPropertiesAndMethods(unittest.TestCase):
def __getitem__(self, key):
return self.get(key, 0)
def __setitem__(self_local, key, value):
self.assertIsInstance(key, type(0))
self.assertIsInstance(key, int)
dict.__setitem__(self_local, key, value)
def setstate(self, state):
self.state = state
@ -871,7 +871,7 @@ class ClassPropertiesAndMethods(unittest.TestCase):
self.assertEqual(a.getstate(), 10)
class D(dict, C):
def __init__(self):
type({}).__init__(self)
dict.__init__(self)
C.__init__(self)
d = D()
self.assertEqual(list(d.keys()), [])
@ -3288,7 +3288,7 @@ order (MRO) for bases """
cant(True, int)
cant(2, bool)
o = object()
cant(o, type(1))
cant(o, int)
cant(o, type(None))
del o
class G(object):