mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:39:12 +00:00
Format implicit string continuation (#5328)
This commit is contained in:
parent
313711aaf9
commit
49cabca3e7
9 changed files with 443 additions and 60 deletions
|
@ -66,6 +66,54 @@ String '"""
|
|||
'''Multiline
|
||||
String \"\"\"
|
||||
'''
|
||||
|
||||
# String continuation
|
||||
|
||||
"Let's" "start" "with" "a" "simple" "example"
|
||||
|
||||
"Let's" "start" "with" "a" "simple" "example" "now repeat after me:" "I am confident" "I am confident" "I am confident" "I am confident" "I am confident"
|
||||
|
||||
(
|
||||
"Let's" "start" "with" "a" "simple" "example" "now repeat after me:" "I am confident" "I am confident" "I am confident" "I am confident" "I am confident"
|
||||
)
|
||||
|
||||
if (
|
||||
a + "Let's"
|
||||
"start"
|
||||
"with"
|
||||
"a"
|
||||
"simple"
|
||||
"example"
|
||||
"now repeat after me:"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
):
|
||||
pass
|
||||
|
||||
if "Let's" "start" "with" "a" "simple" "example" "now repeat after me:" "I am confident" "I am confident" "I am confident" "I am confident" "I am confident":
|
||||
pass
|
||||
|
||||
(
|
||||
# leading
|
||||
"a" # trailing part commen
|
||||
|
||||
# leading part comment
|
||||
|
||||
"b" # trailing second part comment
|
||||
# trailing
|
||||
)
|
||||
|
||||
test_particular = [
|
||||
# squares
|
||||
'1.00000000100000000025',
|
||||
'1.0000000000000000000000000100000000000000000000000' #...
|
||||
'00025',
|
||||
'1.0000000000000000000000000000000000000000000010000' #...
|
||||
'0000000000000000000000000000000000000000025',
|
||||
]
|
||||
```
|
||||
|
||||
## Outputs
|
||||
|
@ -140,6 +188,77 @@ String '"""
|
|||
"""Multiline
|
||||
String \"\"\"
|
||||
"""
|
||||
|
||||
# String continuation
|
||||
|
||||
"Let's" "start" "with" "a" "simple" "example"
|
||||
|
||||
"Let's" "start" "with" "a" "simple" "example" "now repeat after me:" "I am confident" "I am confident" "I am confident" "I am confident" "I am confident"
|
||||
|
||||
(
|
||||
"Let's"
|
||||
"start"
|
||||
"with"
|
||||
"a"
|
||||
"simple"
|
||||
"example"
|
||||
"now repeat after me:"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
)
|
||||
|
||||
if (
|
||||
a
|
||||
+ "Let's"
|
||||
"start"
|
||||
"with"
|
||||
"a"
|
||||
"simple"
|
||||
"example"
|
||||
"now repeat after me:"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
):
|
||||
pass
|
||||
|
||||
if (
|
||||
"Let's"
|
||||
"start"
|
||||
"with"
|
||||
"a"
|
||||
"simple"
|
||||
"example"
|
||||
"now repeat after me:"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
"I am confident"
|
||||
):
|
||||
pass
|
||||
|
||||
(
|
||||
# leading
|
||||
"a" # trailing part commen
|
||||
# leading part comment
|
||||
"b" # trailing second part comment
|
||||
# trailing
|
||||
)
|
||||
|
||||
test_particular = [
|
||||
# squares
|
||||
"1.00000000100000000025",
|
||||
"1.0000000000000000000000000100000000000000000000000" # ...
|
||||
"00025",
|
||||
"1.0000000000000000000000000000000000000000000010000" # ...
|
||||
"0000000000000000000000000000000000000000025",
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
|
@ -214,6 +333,77 @@ String '"""
|
|||
'''Multiline
|
||||
String \"\"\"
|
||||
'''
|
||||
|
||||
# String continuation
|
||||
|
||||
"Let's" 'start' 'with' 'a' 'simple' 'example'
|
||||
|
||||
"Let's" 'start' 'with' 'a' 'simple' 'example' 'now repeat after me:' 'I am confident' 'I am confident' 'I am confident' 'I am confident' 'I am confident'
|
||||
|
||||
(
|
||||
"Let's"
|
||||
'start'
|
||||
'with'
|
||||
'a'
|
||||
'simple'
|
||||
'example'
|
||||
'now repeat after me:'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
)
|
||||
|
||||
if (
|
||||
a
|
||||
+ "Let's"
|
||||
'start'
|
||||
'with'
|
||||
'a'
|
||||
'simple'
|
||||
'example'
|
||||
'now repeat after me:'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
):
|
||||
pass
|
||||
|
||||
if (
|
||||
"Let's"
|
||||
'start'
|
||||
'with'
|
||||
'a'
|
||||
'simple'
|
||||
'example'
|
||||
'now repeat after me:'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
'I am confident'
|
||||
):
|
||||
pass
|
||||
|
||||
(
|
||||
# leading
|
||||
'a' # trailing part commen
|
||||
# leading part comment
|
||||
'b' # trailing second part comment
|
||||
# trailing
|
||||
)
|
||||
|
||||
test_particular = [
|
||||
# squares
|
||||
'1.00000000100000000025',
|
||||
'1.0000000000000000000000000100000000000000000000000' # ...
|
||||
'00025',
|
||||
'1.0000000000000000000000000000000000000000000010000' # ...
|
||||
'0000000000000000000000000000000000000000025',
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue