summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSam Vilain <svilain@saymedia.com>2012-05-27 16:51:37 -0700
committerSam Vilain <svilain@saymedia.com>2012-05-27 16:51:39 -0700
commit0cc907e887a3c089b7e99c49dbc26d1d3b0524b3 (patch)
tree88529c6c3980d5cf5aa4ced96a7af14744988128 /testsuite
parent2c67b37861786b06fdc4fde9f972c4737628ef08 (diff)
downloadpep8-0cc907e887a3c089b7e99c49dbc26d1d3b0524b3.tar.gz
Allow tokens following multi–line string literals to avoid E12*
Multi-line literal strings are a little bit of an outsider when it comes to continuation lines. If such a token is used, consider the code to be OK so long as the next token starts either immediately, or at the same place you'd expect tokens to start again if the multi–line literal wasn't there. This is a corner case, none of the examples are particularly readable, but it shows what does work.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/E12.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/E12.py b/testsuite/E12.py
index b7df20a..fe881d5 100644
--- a/testsuite/E12.py
+++ b/testsuite/E12.py
@@ -175,3 +175,34 @@ if foo is None and bar is "frop" and \
if (foo is None and bar is "e127" and \
blah == 'yeah'):
blah = 'yeahnah'
+#: Okay
+if blah:
+ # is this actually readable? :)
+ multiline_literal = """
+while True:
+ if True:
+ 1
+""".lstrip()
+ multiline_literal = (
+ """
+while True:
+ if True:
+ 1
+""".lstrip()
+ )
+ multiline_literal = (
+ """
+while True:
+ if True:
+ 1
+"""
+ .lstrip()
+ )
+#: Okay
+if blah:
+ multiline_visual = ("""
+while True:
+ if True:
+ 1
+"""
+ .lstrip())