Skip to content

Commit

Permalink
for #262
Browse files Browse the repository at this point in the history
  • Loading branch information
Hideo Hattori committed Oct 31, 2016
1 parent 0ede8c6 commit efe4aa3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion autopep8.py
Expand Up @@ -76,7 +76,7 @@ class documentation for more information.

PYTHON_SHEBANG_REGEX = re.compile(r'^#!.*\bpython[23]?\b\s*$')
LAMBDA_REGEX = re.compile(r'([\w.]+)\s=\slambda\s+([\w,\s.]+):')
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')


# For generating line shortening candidates.
Expand Down
14 changes: 14 additions & 0 deletions test/test_autopep8.py
Expand Up @@ -3755,6 +3755,20 @@ def test_e713_and_e714(self):
options=['-aa', '--select=E713,E714']) as result:
self.assertEqual(fixed, result)

def test_e713_with_single_quote(self):
line = "if not 'DC IP' in info:\n"
fixed = "if 'DC IP' not in info:\n"
with autopep8_context(line,
options=['-aa', '--select=E713,E714']) as result:
self.assertEqual(fixed, result)

def test_e714_with_single_quote(self):
line = "if not 'DC IP' is info:\n"
fixed = "if 'DC IP' is not info:\n"
with autopep8_context(line,
options=['-aa', '--select=E713,E714']) as result:
self.assertEqual(fixed, result)

def test_e721(self):
line = "type('') == type('')\n"
fixed = "isinstance('', type(''))\n"
Expand Down

0 comments on commit efe4aa3

Please sign in to comment.