Skip to content

Commit 6a2f71b

Browse files
committed
Fix false positive E713; issue #330
1 parent ab63c97 commit 6a2f71b

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Bug fixes:
3636

3737
* Don't crash if os.path.expanduser() throws an ImportError. (Issue #297)
3838

39-
* Fix false positive E711/E712. (Issue #336)
39+
* Fix false positive E711/E712/E713. (Issues #330 and #336)
4040

4141

4242
1.5.7 (2014-05-29)

pep8.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)')
109109
COMPARE_SINGLETON_REGEX = re.compile(r'\b(None|False|True)?\s*([=!]=)'
110110
r'\s*(?(1)|(None|False|True))\b')
111-
COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+[^[({ ]+\s+(in|is)\s')
111+
COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+[^][)(}{ ]+\s+(in|is)\s')
112112
COMPARE_TYPE_REGEX = re.compile(r'(?:[=!]=|is(?:\s+not)?)\s*type(?:s.\w+Type'
113113
r'|\s*\(\s*([^)]*[^ )])\s*\))')
114114
KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS))

testsuite/E71.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,28 @@
4646
#: E714
4747
if not X.B is Y:
4848
pass
49+
50+
#
4951
#: Okay
5052
if x not in y:
5153
pass
54+
5255
if not (X in Y or X is Z):
5356
pass
57+
5458
if not (X in Y):
5559
pass
60+
5661
if x is not y:
5762
pass
5863

5964
if TrueElement.get_element(True) == TrueElement.get_element(False):
6065
pass
66+
6167
if (True) == TrueElement or x == TrueElement:
6268
pass
69+
70+
assert (not foo) in bar
71+
assert {'x': not foo} in bar
72+
assert [42, not foo] in bar
6373
#:

0 commit comments

Comments
 (0)