summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lee <IanLee1521@gmail.com>2015-10-08 08:08:26 -0700
committerIan Lee <IanLee1521@gmail.com>2015-10-08 08:08:26 -0700
commit5a56e326e4b200b361f6e8ad53c026d524fc59ac (patch)
tree86af4b7e1cd0da20bfd0c8fb69101f9e8e952ec0
parentb1bde9f2bbcad0f3c86960e58c7cb98ec0cbfd77 (diff)
parent0d2fe46ddc406758f823c34989a2331bc3a3b372 (diff)
downloadpep8-5a56e326e4b200b361f6e8ad53c026d524fc59ac.tar.gz
Merge pull request #442 from tonkoandrew/master
Fix regression in catching E711 (issue #435), add tests
-rwxr-xr-xpep8.py2
-rw-r--r--testsuite/E71.py18
2 files changed, 19 insertions, 1 deletions
diff --git a/pep8.py b/pep8.py
index 884952b..c22e63e 100755
--- a/pep8.py
+++ b/pep8.py
@@ -108,7 +108,7 @@ ERRORCODE_REGEX = re.compile(r'\b[A-Z]\d{3}\b')
DOCSTRING_REGEX = re.compile(r'u?r?["\']')
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*([=!]=)'
+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_TYPE_REGEX = re.compile(r'(?:[=!]=|is(?:\s+not)?)\s*type(?:s.\w+Type'
diff --git a/testsuite/E71.py b/testsuite/E71.py
index ea870e5..7464da9 100644
--- a/testsuite/E71.py
+++ b/testsuite/E71.py
@@ -10,6 +10,18 @@ if None == res:
#: E711
if None != res:
pass
+#: E711
+if res[1] == None:
+ pass
+#: E711
+if res[1] != None:
+ pass
+#: E711
+if None != res[1]:
+ pass
+#: E711
+if None == res[1]:
+ pass
#
#: E712
@@ -24,6 +36,12 @@ if True != res:
#: E712
if False == res:
pass
+#: E712
+if res[1] == True:
+ pass
+#: E712
+if res[1] != False:
+ pass
#
#: E713