summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorAntony Lee <anntzer.lee@gmail.com>2020-02-26 00:33:24 +0100
committerAntony Lee <anntzer.lee@gmail.com>2020-02-26 13:56:02 +0100
commitb36fba61bdcbfe336afe53838eb85dde530e6f69 (patch)
tree861fa7b870c98ed528f002f7064f0af850209992 /testsuite
parent68cc24fbe60ce31e2f9b40dc6dd484b2abf3a705 (diff)
downloadpep8-b36fba61bdcbfe336afe53838eb85dde530e6f69.tar.gz
Support visual indent of continuation lines after with/assert/raise.
"with" is likely the most common case, and this indentation is explicitly given as example by PEP8 (under "maximum line length").
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/E12.py24
-rw-r--r--testsuite/E12not.py20
2 files changed, 43 insertions, 1 deletions
diff --git a/testsuite/E12.py b/testsuite/E12.py
index acdd81f..968382c 100644
--- a/testsuite/E12.py
+++ b/testsuite/E12.py
@@ -372,4 +372,26 @@ print(True)
print(a
, end=' ')
-#:
+#: E127:4:12
+def foo():
+ pass
+ raise 123 + \
+ 123
+#: E127:4:13
+class Eggs:
+ pass
+ assert 123456 == \
+ 123456
+#: E127:4:11
+def f1():
+ print('foo')
+ with open('/path/to/some/file/you/want/to/read') as file_1, \
+ open('/path/to/some/file/being/written', 'w') as file_2:
+ file_2.write(file_1.read())
+#: E127:5:11
+def f1():
+ print('foo')
+ with open('/path/to/some/file/you/want/to/read') as file_1, \
+ open('/path/to/some/file/being/written', 'w') as file_2, \
+ open('later-misindent'):
+ file_2.write(file_1.read())
diff --git a/testsuite/E12not.py b/testsuite/E12not.py
index ebaa078..2e2366c 100644
--- a/testsuite/E12not.py
+++ b/testsuite/E12not.py
@@ -639,3 +639,23 @@ print dedent(
# more stuff
)
)
+
+
+def foo():
+ pass
+ raise 123 + \
+ 123
+
+
+class Eggs:
+ pass
+ assert 123456 == \
+ 123456
+
+
+def f1():
+ print('foo')
+ with open('/path/to/some/file/you/want/to/read') as file_1, \
+ open('/path/to/some/file/being/written', 'w') as file_2, \
+ open('just-making-sure-more-continuations-also-work'):
+ file_2.write(file_1.read())