Skip to content

Commit dcedb98

Browse files
committed
Correct test assertions for E721
* `type(a) is type(b)` should still fail * same for `type(a) != type(b) or type(a) == type(ccc)` * We cannot assume `res == types.IntType` is wrong as the identity of the objects is not known at check time, either way it shouldn't be a E721 as it doesn't involve type(...) function as described in PEP8
1 parent f3ee72b commit dcedb98

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

pycodestyle.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,6 @@ def comparison_type(logical_line, noqa):
14651465
common base class, basestring, so you can do:
14661466
14671467
Okay: if isinstance(obj, basestring):
1468-
Okay: if type(a1) is type(b1):
14691468
"""
14701469
match = COMPARE_TYPE_REGEX.search(logical_line)
14711470
if match and not noqa:

testsuite/E72.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#: E721
55
if type(res) != type(""):
66
pass
7-
#: E721
7+
#: Okay
88
import types
99

1010
if res == types.IntType:
@@ -47,8 +47,6 @@
4747
pass
4848
if isinstance(res, types.MethodType):
4949
pass
50-
if type(a) != type(b) or type(a) == type(ccc):
51-
pass
5250
#: Okay
5351
def func_histype(a, b, c):
5452
pass

0 commit comments

Comments
 (0)