diff options
author | Ian Stapleton Cordasco <graffatcolmingov@gmail.com> | 2018-01-17 22:42:22 -0600 |
---|---|---|
committer | Ian Stapleton Cordasco <graffatcolmingov@gmail.com> | 2018-01-17 22:42:22 -0600 |
commit | a3f7585d9135c5bef13b5a91f3358f4fabb83e0c (patch) | |
tree | b6badebd08ddb8a0e1e90e343c003425f2538282 /testsuite | |
parent | 8f3aebdd2bbe08111e7bc76f2722bab965ab571c (diff) | |
download | pep8-a3f7585d9135c5bef13b5a91f3358f4fabb83e0c.tar.gz |
Fix up testsuite for W504
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/E12not.py | 29 | ||||
-rw-r--r-- | testsuite/W19.py | 18 | ||||
-rw-r--r-- | testsuite/test_all.py | 2 | ||||
-rw-r--r-- | testsuite/test_api.py | 4 |
4 files changed, 24 insertions, 29 deletions
diff --git a/testsuite/E12not.py b/testsuite/E12not.py index 34d6efe..ebaa078 100644 --- a/testsuite/E12not.py +++ b/testsuite/E12not.py @@ -16,12 +16,11 @@ if x == 2 \ or y > 1 \ or x == 3: pass - - +#: W503 if (foo == bar and baz == frop): pass - +#: W503 if ( foo == bar and baz == frop @@ -108,7 +107,7 @@ sat = 'AAA' \ 'BBB' \ 'iii' \ 'CCC' - +#: W504 W504 abricot = (3 + 4 + 5 + 6) @@ -137,8 +136,7 @@ def long_function_name( var_one, var_two, var_three, var_four): print(var_one) - - +#: W504 if ((row < 0 or self.moduleCount <= row or col < 0 or self.moduleCount <= col)): raise Exception("%s,%s - %s" % (row, col, self.moduleCount)) @@ -183,23 +181,23 @@ if bar: "to match that of the opening " "bracket's line" ) -# +#: W504 # you want vertical alignment, so use a parens if ((foo.bar("baz") and foo.bar("frop") )): print "yes" - +#: W504 # also ok, but starting to look like LISP if ((foo.bar("baz") and foo.bar("frop"))): print "yes" - +#: W504 if (a == 2 or b == "abc def ghi" "jkl mno"): return True - +#: W504 if (a == 2 or b == """abc def ghi jkl mno"""): @@ -223,22 +221,19 @@ print 'l.{line}\t{pos}\t{name}\t{text}'.format( print('%-7d %s per second (%d total)' % ( options.counters[key] / elapsed, key, options.counters[key])) - - +#: W504 if os.path.exists(os.path.join(path, PEP8_BIN)): cmd = ([os.path.join(path, PEP8_BIN)] + self._pep8_options(targetfile)) - - +#: W504 fixed = (re.sub(r'\t+', ' ', target[c::-1], 1)[::-1] + target[c + 1:]) - +#: W504 fixed = ( re.sub(r'\t+', ' ', target[c::-1], 1)[::-1] + target[c + 1:] ) - - +#: W504 if foo is None and bar is "frop" and \ blah == 'yeah': blah = 'yeahnah' diff --git a/testsuite/W19.py b/testsuite/W19.py index afdfb76..ed69e2b 100644 --- a/testsuite/W19.py +++ b/testsuite/W19.py @@ -7,7 +7,7 @@ if False: #: W191 y = x == 2 \ or x == 3 -#: E101 W191 +#: E101 W191 W504 if ( x == ( 3 @@ -26,11 +26,11 @@ if x == 2 \ pass #: -#: E101 W191 +#: E101 W191 W504 if (foo == bar and baz == frop): pass -#: E101 W191 +#: E101 W191 W504 if ( foo == bar and baz == frop @@ -52,7 +52,7 @@ def long_function_name( var_one, var_two, var_three, var_four): print(var_one) -#: E101 W191 +#: E101 W191 W504 if ((row < 0 or self.moduleCount <= row or col < 0 or self.moduleCount <= col)): raise Exception("%s,%s - %s" % (row, col, self.moduleCount)) @@ -65,23 +65,23 @@ if bar: "bracket's line" ) # -#: E101 W191 +#: E101 W191 W504 # you want vertical alignment, so use a parens if ((foo.bar("baz") and foo.bar("frop") )): print "yes" -#: E101 W191 +#: E101 W191 W504 # also ok, but starting to look like LISP if ((foo.bar("baz") and foo.bar("frop"))): print "yes" -#: E101 W191 +#: E101 W191 W504 if (a == 2 or b == "abc def ghi" "jkl mno"): return True -#: E101 W191 +#: E101 W191 W504 if (a == 2 or b == """abc def ghi jkl mno"""): @@ -93,7 +93,7 @@ if length > options.max_line_length: # -#: E101 W191 W191 +#: E101 W191 W191 W504 if os.path.exists(os.path.join(path, PEP8_BIN)): cmd = ([os.path.join(path, PEP8_BIN)] + self._pep8_options(targetfile)) diff --git a/testsuite/test_all.py b/testsuite/test_all.py index 08f9ea9..f571a7b 100644 --- a/testsuite/test_all.py +++ b/testsuite/test_all.py @@ -43,7 +43,7 @@ class PycodestyleTestCase(unittest.TestCase): os.path.join(ROOT_DIR, 'setup.py')] report = self._style.init_report(pycodestyle.StandardReport) report = self._style.check_files(files) - self.assertFalse(report.total_errors, + self.assertEqual(list(report.messages.keys()), ['W504'], msg='Failures: %s' % report.messages) diff --git a/testsuite/test_api.py b/testsuite/test_api.py index 4d8b7b2..6eb9f04 100644 --- a/testsuite/test_api.py +++ b/testsuite/test_api.py @@ -166,7 +166,7 @@ class APITestCase(unittest.TestCase): self.assertEqual(pep8style.options.filename, ['*.py']) self.assertEqual(pep8style.options.format, 'default') self.assertEqual(pep8style.options.select, ()) - self.assertEqual(pep8style.options.ignore, ('E226', 'E24')) + self.assertEqual(pep8style.options.ignore, ('E226', 'E24', 'W504')) self.assertEqual(pep8style.options.max_line_length, 79) def test_styleguide_ignore_code(self): @@ -182,7 +182,7 @@ class APITestCase(unittest.TestCase): self.assertEqual(options.select, ()) self.assertEqual( options.ignore, - ('E121', 'E123', 'E126', 'E226', 'E24', 'E704', 'W503') + ('E121', 'E123', 'E126', 'E226', 'E24', 'E704', 'W503', 'W504') ) options = parse_argv('--doctest').options |