diff options
-rwxr-xr-x | pycodestyle.py | 6 | ||||
-rw-r--r-- | testsuite/E71.py | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/pycodestyle.py b/pycodestyle.py index f5d2f89..c091639 100755 --- a/pycodestyle.py +++ b/pycodestyle.py @@ -1393,8 +1393,10 @@ def comparison_to_singleton(logical_line, noqa): None was set to some other value. The other value might have a type (such as a container) that could be false in a boolean context! """ - match = not noqa and COMPARE_SINGLETON_REGEX.search(logical_line) - if match: + if noqa: + return + + for match in COMPARE_SINGLETON_REGEX.finditer(logical_line): singleton = match.group(1) or match.group(3) same = (match.group(2) == '==') diff --git a/testsuite/E71.py b/testsuite/E71.py index abf4e7a..b4b53af 100644 --- a/testsuite/E71.py +++ b/testsuite/E71.py @@ -42,6 +42,8 @@ if res[1] == True: #: E712 if res[1] != False: pass +#: E712 E712 +var = 1 if cond == True else -1 if cond == False else cond # #: E713 |