ruff/crates/ruff_python_formatter/tests/snapshots/black_compatibility@fstring.py.snap
2023-06-26 08:46:18 +00:00

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"}\''
```