Preserve indent around multiline strings (#9637)

This commit is contained in:
Micha Reiser 2024-01-26 08:18:30 +01:00 committed by GitHub
parent 5fe0fdd0a8
commit 91046e4c81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 92 additions and 94 deletions

View file

@ -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