mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-03 21:24:29 +00:00
## Summary This formats call expressions with magic trailing comma and parentheses behaviour but without call chaining ## Test Plan Lots of new test fixtures, including some that don't work yet
65 lines
890 B
Text
65 lines
890 B
Text
---
|
|
source: crates/ruff_python_formatter/tests/fixtures.rs
|
|
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/fmtskip5.py
|
|
---
|
|
## Input
|
|
|
|
```py
|
|
a, b, c = 3, 4, 5
|
|
if (
|
|
a == 3
|
|
and b != 9 # fmt: skip
|
|
and c is not None
|
|
):
|
|
print("I'm good!")
|
|
else:
|
|
print("I'm bad")
|
|
```
|
|
|
|
## Black Differences
|
|
|
|
```diff
|
|
--- Black
|
|
+++ Ruff
|
|
@@ -1,7 +1,8 @@
|
|
a, b, c = 3, 4, 5
|
|
if (
|
|
a == 3
|
|
- and b != 9 # fmt: skip
|
|
+ and b
|
|
+ != 9 # fmt: skip
|
|
and c is not None
|
|
):
|
|
print("I'm good!")
|
|
```
|
|
|
|
## Ruff Output
|
|
|
|
```py
|
|
a, b, c = 3, 4, 5
|
|
if (
|
|
a == 3
|
|
and b
|
|
!= 9 # fmt: skip
|
|
and c is not None
|
|
):
|
|
print("I'm good!")
|
|
else:
|
|
print("I'm bad")
|
|
```
|
|
|
|
## Black Output
|
|
|
|
```py
|
|
a, b, c = 3, 4, 5
|
|
if (
|
|
a == 3
|
|
and b != 9 # fmt: skip
|
|
and c is not None
|
|
):
|
|
print("I'm good!")
|
|
else:
|
|
print("I'm bad")
|
|
```
|
|
|
|
|