diff options
author | Susannah Klaneček <suzil@protonmail.ch> | 2020-05-01 09:22:18 -0400 |
---|---|---|
committer | Susannah Klaneček <suzil@protonmail.ch> | 2020-05-01 09:42:27 -0400 |
commit | 5230110c339133b2da060ef3f5c04a55c40fc096 (patch) | |
tree | 07e30b6a9c26fbd3d5f073055ee7604e00b0634d | |
parent | a238201edd2883fcc0400df4a11cbb6fd5f6e5d7 (diff) | |
download | pep8-5230110c339133b2da060ef3f5c04a55c40fc096.tar.gz |
E714: fix chained is not
Closes #767
-rwxr-xr-x | pycodestyle.py | 3 | ||||
-rw-r--r-- | testsuite/E71.py | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/pycodestyle.py b/pycodestyle.py index fe45548..b1fb8a7 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(not)\s+[^][)(}{ ]+\s+(in|is)' + r'\s+(?!not\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..e7f8869 100644 --- a/testsuite/E71.py +++ b/testsuite/E71.py @@ -64,6 +64,9 @@ if not X is Y: #: E714 if not X.B is Y: pass +#: E714 +if not X is Y is not Z: + pass # #: Okay @@ -79,6 +82,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 |