mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-01 04:18:05 +00:00
Preserve indent around multiline strings (#9637)
This commit is contained in:
parent
5fe0fdd0a8
commit
91046e4c81
4 changed files with 92 additions and 94 deletions
|
|
@ -301,7 +301,19 @@ this_will_also_become_one_line = ( # comment
|
|||
# Another use case
|
||||
data = yaml.load("""\
|
||||
a: 1
|
||||
@@ -85,11 +114,13 @@
|
||||
@@ -77,19 +106,23 @@
|
||||
b: 2
|
||||
""",
|
||||
)
|
||||
-data = yaml.load("""\
|
||||
+data = yaml.load(
|
||||
+ """\
|
||||
a: 1
|
||||
b: 2
|
||||
-""")
|
||||
+"""
|
||||
+)
|
||||
|
||||
MULTILINE = """
|
||||
foo
|
||||
""".replace("\n", "")
|
||||
|
|
@ -316,7 +328,7 @@ this_will_also_become_one_line = ( # comment
|
|||
parser.usage += """
|
||||
Custom extra help summary.
|
||||
|
||||
@@ -156,16 +187,24 @@
|
||||
@@ -156,16 +189,24 @@
|
||||
10 LOAD_CONST 0 (None)
|
||||
12 RETURN_VALUE
|
||||
""" % (_C.__init__.__code__.co_firstlineno + 1,)
|
||||
|
|
@ -347,7 +359,7 @@ this_will_also_become_one_line = ( # comment
|
|||
[
|
||||
"""cow
|
||||
moos""",
|
||||
@@ -198,7 +237,7 @@
|
||||
@@ -198,7 +239,7 @@
|
||||
`--global-option` is reserved to flags like `--verbose` or `--quiet`.
|
||||
"""
|
||||
|
||||
|
|
@ -356,7 +368,7 @@ this_will_also_become_one_line = ( # comment
|
|||
|
||||
this_will_stay_on_three_lines = (
|
||||
"a" # comment
|
||||
@@ -206,4 +245,6 @@
|
||||
@@ -206,4 +247,6 @@
|
||||
"c"
|
||||
)
|
||||
|
||||
|
|
@ -477,10 +489,12 @@ a: 1
|
|||
b: 2
|
||||
""",
|
||||
)
|
||||
data = yaml.load("""\
|
||||
data = yaml.load(
|
||||
"""\
|
||||
a: 1
|
||||
b: 2
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
MULTILINE = """
|
||||
foo
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue