diff options
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rwxr-xr-x | pep8.py | 2 | ||||
-rw-r--r-- | testsuite/E71.py | 10 |
3 files changed, 12 insertions, 2 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 3427e9b..657ada9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -36,7 +36,7 @@ Bug fixes: * Don't crash if os.path.expanduser() throws an ImportError. (Issue #297) -* Fix false positive E711/E712. (Issue #336) +* Fix false positive E711/E712/E713. (Issues #330 and #336) 1.5.7 (2014-05-29) @@ -108,7 +108,7 @@ EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]') WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)') COMPARE_SINGLETON_REGEX = re.compile(r'\b(None|False|True)?\s*([=!]=)' r'\s*(?(1)|(None|False|True))\b') -COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+[^[({ ]+\s+(in|is)\s') +COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+[^][)(}{ ]+\s+(in|is)\s') COMPARE_TYPE_REGEX = re.compile(r'(?:[=!]=|is(?:\s+not)?)\s*type(?:s.\w+Type' r'|\s*\(\s*([^)]*[^ )])\s*\))') KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS)) diff --git a/testsuite/E71.py b/testsuite/E71.py index 25a308f..ea870e5 100644 --- a/testsuite/E71.py +++ b/testsuite/E71.py @@ -46,18 +46,28 @@ if not X is Y: #: E714 if not X.B is Y: pass + +# #: Okay if x not in y: pass + if not (X in Y or X is Z): pass + if not (X in Y): pass + if x is not y: pass if TrueElement.get_element(True) == TrueElement.get_element(False): pass + if (True) == TrueElement or x == TrueElement: pass + +assert (not foo) in bar +assert {'x': not foo} in bar +assert [42, not foo] in bar #: |