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:
konsti 2023-10-11 13:30:34 +02:00 committed by GitHub
parent a1ee6d28ce
commit 644011fb14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 1 deletions

View file

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