mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Formatter quoting for f-strings with triple quotes (#7826)
**Summary** Quoting of f-strings can change if they are triple quoted and only contain single quotes inside. Fixes #6841 **Test Plan** New fixtures --------- Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
This commit is contained in:
parent
a1ee6d28ce
commit
644011fb14
3 changed files with 25 additions and 1 deletions
|
@ -63,6 +63,11 @@ result_f = (
|
|||
),
|
||||
2
|
||||
)
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/6841
|
||||
x = f'''a{""}b'''
|
||||
y = f'''c{1}d"""e'''
|
||||
z = f'''a{""}b''' f'''c{1}d"""e'''
|
||||
```
|
||||
|
||||
## Output
|
||||
|
@ -124,6 +129,11 @@ result_f = (
|
|||
),
|
||||
2,
|
||||
)
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/6841
|
||||
x = f"""a{""}b"""
|
||||
y = f'''c{1}d"""e'''
|
||||
z = f"""a{""}b""" f'''c{1}d"""e'''
|
||||
```
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue