Merge "Fix double word hacking test" into stable/rocky

This commit is contained in:
Zuul 2019-07-24 19:09:57 +00:00 committed by Gerrit Code Review
commit 9c6d900486
1 changed files with 6 additions and 4 deletions

View File

@ -275,7 +275,7 @@ class HackingTestCase(test.NoDBTestCase):
def _run_check(self, code, checker, filename=None):
pep8.register_check(checker)
lines = textwrap.dedent(code).strip().splitlines(True)
lines = textwrap.dedent(code).lstrip().splitlines(True)
checker = pep8.Checker(filename=filename, lines=lines)
# NOTE(sdague): the standard reporter has printing to stdout
@ -580,12 +580,14 @@ class HackingTestCase(test.NoDBTestCase):
def test_check_doubled_words(self):
errors = [(1, 0, "N343")]
# Artificial break to stop pep8 detecting the test !
code = "This is the" + " the best comment"
# Explicit addition of line-ending here and below since this isn't a
# block comment and without it we trigger #1804062. Artificial break is
# necessary to stop flake8 detecting the test
code = "'This is the" + " the best comment'\n"
self._assert_has_errors(code, checks.check_doubled_words,
expected_errors=errors)
code = "This is the then best comment"
code = "'This is the then best comment'\n"
self._assert_has_no_errors(code, checks.check_doubled_words)
def test_dict_iteritems(self):