mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-30143: 2to3 now generates a code that uses abstract collection classes (#1262)
from collections.abc rather than collections.
This commit is contained in:
parent
a7368ac636
commit
0a2abdfca2
4 changed files with 18 additions and 16 deletions
|
@ -4427,12 +4427,12 @@ class Test_operator(FixerTestCase):
|
|||
|
||||
def test_operator_isSequenceType(self):
|
||||
b = "operator.isSequenceType(x)"
|
||||
a = "import collections\nisinstance(x, collections.Sequence)"
|
||||
a = "import collections.abc\nisinstance(x, collections.abc.Sequence)"
|
||||
self.check(b, a)
|
||||
|
||||
def test_operator_isMappingType(self):
|
||||
b = "operator.isMappingType(x)"
|
||||
a = "import collections\nisinstance(x, collections.Mapping)"
|
||||
a = "import collections.abc\nisinstance(x, collections.abc.Mapping)"
|
||||
self.check(b, a)
|
||||
|
||||
def test_operator_isNumberType(self):
|
||||
|
@ -4478,12 +4478,12 @@ class Test_operator(FixerTestCase):
|
|||
|
||||
def test_bare_operator_isSequenceType(self):
|
||||
s = "isSequenceType(z)"
|
||||
t = "You should use 'isinstance(z, collections.Sequence)' here."
|
||||
t = "You should use 'isinstance(z, collections.abc.Sequence)' here."
|
||||
self.warns_unchanged(s, t)
|
||||
|
||||
def test_bare_operator_isMappingType(self):
|
||||
s = "isMappingType(x)"
|
||||
t = "You should use 'isinstance(x, collections.Mapping)' here."
|
||||
t = "You should use 'isinstance(x, collections.abc.Mapping)' here."
|
||||
self.warns_unchanged(s, t)
|
||||
|
||||
def test_bare_operator_isNumberType(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue