Skip to content

Commit a362ddb

Browse files
committed
accept new unsupported syntax errors
1 parent f08aba3 commit a362ddb

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

crates/ruff_python_formatter/tests/snapshots/black_compatibility@cases__fstring.py.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,17 @@ f'Hello \'{tricky + "example"}\''
7272
f"Tried directories {str(rootdirs)} \
7373
but none started with prefix {parentdir_prefix}"
7474
```
75+
76+
## New Unsupported Syntax Errors
77+
78+
error[invalid-syntax]: Cannot reuse outer quote character in f-strings on Python 3.10 (syntax was added in Python 3.12)
79+
--> fstring.py:6:9
80+
|
81+
4 | f"some f-string with {a} {few():.2f} {formatted.values!r}"
82+
5 | f"some f-string with {a} {few(''):.2f} {formatted.values!r}"
83+
6 | f"{f'''{"nested"} inner'''} outer"
84+
| ^
85+
7 | f'"{f"{nested} inner"}" outer'
86+
8 | f"space between opening braces: { {a for a in (1, 2, 3)} }"
87+
|
88+
warning: Only accept new syntax errors if they are also present in the input. The formatter should not introduce syntax errors.

0 commit comments

Comments
 (0)