diff options
author | Antony Lee <anntzer.lee@gmail.com> | 2020-02-26 00:44:36 +0100 |
---|---|---|
committer | Antony Lee <anntzer.lee@gmail.com> | 2020-02-26 00:56:41 +0100 |
commit | 9184238b5668829759babcef61a70b2a6d433162 (patch) | |
tree | 7c6dfcc7133e5b533263fe4ab23f38b0db04c92e /testsuite | |
parent | 68cc24fbe60ce31e2f9b40dc6dd484b2abf3a705 (diff) | |
download | pep8-9184238b5668829759babcef61a70b2a6d433162.tar.gz |
Correctly allow *two* blank lines after a block of one-liners.
Previously
```
def oneliner(): pass
def otheroneliner(): pass
def really_long_func():
with_some_contents
```
would raise an "E302: expected 2 blank lines, found zero" at the last
line of the one liner. Ultimately, this is due to `expand_indent` being
passed a line whose contents are just a newline and nothing else, and
`expand_indent` thinking that the line is indented by 1 character (the
newline), which is wrong.
Fix that by just stripping the newline, and modify a test to cover this
case.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/E30not.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/testsuite/E30not.py b/testsuite/E30not.py index ef795a8..ba0f742 100644 --- a/testsuite/E30not.py +++ b/testsuite/E30not.py @@ -167,6 +167,10 @@ def foo(x): # for no E30x being emitted. def bar(): pass def baz(): pass + + +def main(): + pass #: E704:4:5 E704:5:5 def foo(): # This emits the (ignored-by-default) E704, but here we're testing |