mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
Fix curly bracket spacing around curly f-string expressions (#15471)
This commit is contained in:
parent
6aef4ad008
commit
96c2d0996d
4 changed files with 117 additions and 15 deletions
|
@ -716,6 +716,14 @@ f'{x:a{y=:{z:hy "user"}}} \'\'\''
|
|||
f"""{1=: "this" is fine}"""
|
||||
f'''{1=: "this" is fine}''' # Change quotes to double quotes because they're preferred
|
||||
f'{1=: {'ab"cd"'}}' # It's okay if the quotes are in an expression part.
|
||||
|
||||
|
||||
# Regression tests for https://github.com/astral-sh/ruff/issues/15459
|
||||
print(f"{ {1, 2, 3} - {2} }")
|
||||
print(f"{ {1: 2}.keys() }")
|
||||
print(f"{({1, 2, 3}) - ({2})}")
|
||||
print(f"{1, 2, {3} }")
|
||||
print(f"{(1, 2, {3})}")
|
||||
```
|
||||
|
||||
## Outputs
|
||||
|
@ -1490,6 +1498,14 @@ f'{x:a{y=:{z:hy "user"}}} \'\'\''
|
|||
f"""{1=: "this" is fine}"""
|
||||
f"""{1=: "this" is fine}""" # Change quotes to double quotes because they're preferred
|
||||
f'{1=: {'ab"cd"'}}' # It's okay if the quotes are in an expression part.
|
||||
|
||||
|
||||
# Regression tests for https://github.com/astral-sh/ruff/issues/15459
|
||||
print(f"{ {1, 2, 3} - {2} }")
|
||||
print(f"{ {1: 2}.keys() }")
|
||||
print(f"{({1, 2, 3}) - ({2})}")
|
||||
print(f"{1, 2, {3}}")
|
||||
print(f"{(1, 2, {3})}")
|
||||
```
|
||||
|
||||
|
||||
|
@ -2264,4 +2280,12 @@ f'{x:a{y=:{z:hy "user"}}} \'\'\''
|
|||
f"""{1=: "this" is fine}"""
|
||||
f"""{1=: "this" is fine}""" # Change quotes to double quotes because they're preferred
|
||||
f'{1=: {'ab"cd"'}}' # It's okay if the quotes are in an expression part.
|
||||
|
||||
|
||||
# Regression tests for https://github.com/astral-sh/ruff/issues/15459
|
||||
print(f"{ {1, 2, 3} - {2} }")
|
||||
print(f"{ {1: 2}.keys() }")
|
||||
print(f"{({1, 2, 3}) - ({2})}")
|
||||
print(f"{1, 2, {3}}")
|
||||
print(f"{(1, 2, {3})}")
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue