diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2014-03-25 19:35:37 +0100 |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2014-03-25 19:35:37 +0100 |
commit | fed43c5b560c90995e2ea3f742f2bf6b6e497657 (patch) | |
tree | 9892f524f6a57381ee08004e4496babdc75ec26e /testsuite | |
parent | 5685c9799aa72a461d0b41a5ade2ceeb0341efeb (diff) | |
parent | fd5cc44df54b0aeff605ccc62ed1e69fdb52c28b (diff) | |
download | pep8-fed43c5b560c90995e2ea3f742f2bf6b6e497657.tar.gz |
Merge. Allow long lines in docstrings and comments.
Allow long lines in multiline strings and comments if they cannot be wrapped; issue #224
Optionally disable physical line checks inside multiline strings, using '# noqa'; issue #242
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/E50.py | 57 | ||||
-rw-r--r-- | testsuite/E90.py | 2 | ||||
-rw-r--r-- | testsuite/W19.py | 24 | ||||
-rw-r--r-- | testsuite/W29.py | 3 | ||||
-rw-r--r-- | testsuite/W39.py | 6 | ||||
-rw-r--r-- | testsuite/utf-8.py | 12 |
6 files changed, 96 insertions, 8 deletions
diff --git a/testsuite/E50.py b/testsuite/E50.py index 4cc4383..31ad6b9 100644 --- a/testsuite/E50.py +++ b/testsuite/E50.py @@ -45,3 +45,60 @@ ddd = \ (''' ''' + ' \ ') +#: E501 E225 E226 +very_long_identifiers=and_terrible_whitespace_habits(are_no_excuse+for_long_lines) +# +#: E501 +'''multiline string +with a long long long long long long long long long long long long long long long long line +''' +#: E501 +'''same thing, but this time without a terminal newline in the string +long long long long long long long long long long long long long long long long line''' +# +# issue 224 (unavoidable long lines in docstrings) +#: Okay +""" +I'm some great documentation. Because I'm some great documentation, I'm +going to give you a reference to some valuable information about some API +that I'm calling: + + http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx +""" +#: E501 +""" +longnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaces""" +#: Okay +""" +This + almost_empty_line +""" +#: E501 +""" +This + almost_empty_line +""" +#: E501 +# A basic comment +# with a long long long long long long long long long long long long long long long long line + +# +#: Okay +# I'm some great comment. Because I'm so great, I'm going to give you a +# reference to some valuable information about some API that I'm calling: +# +# http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx + +import this + +# longnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaceslongnospaces + +# +#: Okay +# This +# almost_empty_line + +# +#: E501 +# This +# almost_empty_line diff --git a/testsuite/E90.py b/testsuite/E90.py index 2d0b2dc..1db3d0e 100644 --- a/testsuite/E90.py +++ b/testsuite/E90.py @@ -2,7 +2,7 @@ } #: E901 = [x -#: E901 E101 W191 W191 +#: E901 E101 W191 while True: try: pass diff --git a/testsuite/W19.py b/testsuite/W19.py index 3e303d9..edbb1f0 100644 --- a/testsuite/W19.py +++ b/testsuite/W19.py @@ -86,7 +86,7 @@ if (a == 2 or b == """abc def ghi jkl mno"""): return True -#: E101 W191 W191 +#: E101 W191 if length > options.max_line_length: return options.max_line_length, \ "E501 line too long (%d characters)" % length @@ -97,6 +97,28 @@ if length > options.max_line_length: if os.path.exists(os.path.join(path, PEP8_BIN)): cmd = ([os.path.join(path, PEP8_BIN)] + self._pep8_options(targetfile)) +#: W191 +''' + multiline string with tab in it''' +#: E101 W191 +'''multiline string + with tabs + and spaces +''' +#: Okay +'''sometimes, you just need to go nuts in a multiline string + and allow all sorts of crap + like mixed tabs and spaces + +or trailing whitespace +or long long long long long long long long long long long long long long long long long lines +''' # nopep8 +#: Okay +'''this one + will get no warning +even though the noqa comment is not immediately after the string +''' + foo # noqa +# #: E101 W191 if foo is None and bar is "frop" and \ blah == 'yeah': diff --git a/testsuite/W29.py b/testsuite/W29.py index 2578f4f..42802ca 100644 --- a/testsuite/W29.py +++ b/testsuite/W29.py @@ -6,5 +6,8 @@ print class Foo(object): bang = 12 +#: W291 +'''multiline +string with trailing whitespace''' #: W292 # This line doesn't have a linefeed
\ No newline at end of file diff --git a/testsuite/W39.py b/testsuite/W39.py index 4fe4fc4..554814c 100644 --- a/testsuite/W39.py +++ b/testsuite/W39.py @@ -1,3 +1,9 @@ #: W391 # The next line is blank +#: Okay +'''there is nothing wrong +with a multiline string at EOF + +that happens to have a blank line in it +''' diff --git a/testsuite/utf-8.py b/testsuite/utf-8.py index 7a3d249..2cee579 100644 --- a/testsuite/utf-8.py +++ b/testsuite/utf-8.py @@ -31,11 +31,11 @@ class Rectangle(Blob): # 78 narrow chars (Na) + 1 wide char (W) # 01 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8情 -# 2 narrow chars (Na) + 40 wide chars (W) -# 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情 +# 3 narrow chars (Na) + 40 wide chars (W) +# 情 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情 -# 2 narrow chars (Na) + 77 wide chars (W) -# 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情 +# 3 narrow chars (Na) + 76 wide chars (W) +# 情 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情 # #: E501 @@ -47,6 +47,6 @@ class Rectangle(Blob): # 01 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8情情 # #: E501 -# 2 narrow chars (Na) + 78 wide chars (W) -# 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情 +# 3 narrow chars (Na) + 77 wide chars (W) +# 情 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情 # |