Skip to content

Commit 417dd01

Browse files
committed
add new test and snapshot
1 parent 3fcc9ff commit 417dd01

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_skip/compound_one_liners.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,11 @@ def format_string(): return f"Hello {name}, you have {count} items in your cart
132132
if (
133133
long_condition
134134
): a + b # fmt: skip
135+
136+
# over-indented comment example
137+
# See https://github.com/astral-sh/ruff/pull/20633#issuecomment-3453288910
138+
# and https://github.com/astral-sh/ruff/pull/21185
139+
140+
for x in it: foo()
141+
# comment
142+
else: bar() # fmt: skip

crates/ruff_python_formatter/tests/snapshots/format@fmt_skip__compound_one_liners.py.snap

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ finally: cleanup() # fmt: skip
138138
if (
139139
long_condition
140140
): a + b # fmt: skip
141+
142+
# over-indented comment example
143+
# See https://github.com/astral-sh/ruff/pull/20633#issuecomment-3453288910
144+
# and https://github.com/astral-sh/ruff/pull/21185
145+
146+
for x in it: foo()
147+
# comment
148+
else: bar() # fmt: skip
141149
```
142150

143151
## Output
@@ -307,4 +315,13 @@ finally: cleanup() # fmt: skip
307315
if (
308316
long_condition
309317
): a + b # fmt: skip
318+
319+
# over-indented comment example
320+
# See https://github.com/astral-sh/ruff/pull/20633#issuecomment-3453288910
321+
# and https://github.com/astral-sh/ruff/pull/21185
322+
323+
for x in it:
324+
foo()
325+
# comment
326+
else: bar() # fmt: skip
310327
```

0 commit comments

Comments
 (0)