mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 10:23:11 +00:00
73 lines
2.1 KiB
Text
73 lines
2.1 KiB
Text
---
|
|
source: crates/ruff_python_formatter/tests/fixtures.rs
|
|
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/fstring.py
|
|
---
|
|
## Input
|
|
|
|
```py
|
|
f"f-string without formatted values is just a string"
|
|
f"{{NOT a formatted value}}"
|
|
f"{{NOT 'a' \"formatted\" \"value\"}}"
|
|
f"some f-string with {a} {few():.2f} {formatted.values!r}"
|
|
f'some f-string with {a} {few(""):.2f} {formatted.values!r}'
|
|
f"{f'''{'nested'} inner'''} outer"
|
|
f"\"{f'{nested} inner'}\" outer"
|
|
f"space between opening braces: { {a for a in (1, 2, 3)}}"
|
|
f'Hello \'{tricky + "example"}\''
|
|
```
|
|
|
|
## Black Differences
|
|
|
|
```diff
|
|
--- Black
|
|
+++ Ruff
|
|
@@ -1,9 +1,9 @@
|
|
-f"f-string without formatted values is just a string"
|
|
-f"{{NOT a formatted value}}"
|
|
-f'{{NOT \'a\' "formatted" "value"}}'
|
|
-f"some f-string with {a} {few():.2f} {formatted.values!r}"
|
|
-f'some f-string with {a} {few(""):.2f} {formatted.values!r}'
|
|
-f"{f'''{'nested'} inner'''} outer"
|
|
-f"\"{f'{nested} inner'}\" outer"
|
|
-f"space between opening braces: { {a for a in (1, 2, 3)}}"
|
|
-f'Hello \'{tricky + "example"}\''
|
|
+NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
+NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
+NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
+NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
+NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
+NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
+NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
+NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
+NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
```
|
|
|
|
## Ruff Output
|
|
|
|
```py
|
|
NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
NOT_YET_IMPLEMENTED_ExprJoinedStr
|
|
```
|
|
|
|
## Black Output
|
|
|
|
```py
|
|
f"f-string without formatted values is just a string"
|
|
f"{{NOT a formatted value}}"
|
|
f'{{NOT \'a\' "formatted" "value"}}'
|
|
f"some f-string with {a} {few():.2f} {formatted.values!r}"
|
|
f'some f-string with {a} {few(""):.2f} {formatted.values!r}'
|
|
f"{f'''{'nested'} inner'''} outer"
|
|
f"\"{f'{nested} inner'}\" outer"
|
|
f"space between opening braces: { {a for a in (1, 2, 3)}}"
|
|
f'Hello \'{tricky + "example"}\''
|
|
```
|
|
|
|
|