summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpycodestyle.py3
-rw-r--r--testsuite/E71.py9
2 files changed, 11 insertions, 1 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index 7198639..651edfb 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -140,7 +140,8 @@ EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[\[({] | [\]}),;]| :(?!=)')
WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)')
COMPARE_SINGLETON_REGEX = re.compile(r'(\bNone|\bFalse|\bTrue)?\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(?<!is\s)(not)\s+[^][)(}{ ]+\s+'
+ r'(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 7464da9..abf4e7a 100644
--- a/testsuite/E71.py
+++ b/testsuite/E71.py
@@ -64,6 +64,12 @@ if not X is Y:
#: E714
if not X.B is Y:
pass
+#: E714
+if not X is Y is not Z:
+ pass
+#: E714
+if not X is not Y:
+ pass
#
#: Okay
@@ -79,6 +85,9 @@ if not (X in Y):
if x is not y:
pass
+if X is not Y is not Z:
+ pass
+
if TrueElement.get_element(True) == TrueElement.get_element(False):
pass