Fix fmt:off with trailing child comment (#8234)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_on_off/fmt_off_unclosed_deep_nested_trailing_comment.py
|
||||
---
|
||||
## Input
|
||||
```py
|
||||
# Regression test for https://github.com/astral-sh/ruff/issues/8211
|
||||
|
||||
# fmt: off
|
||||
from dataclasses import dataclass
|
||||
|
||||
if True:
|
||||
if False:
|
||||
x: int # Optional[int]
|
||||
```
|
||||
|
||||
## Output
|
||||
```py
|
||||
# Regression test for https://github.com/astral-sh/ruff/issues/8211
|
||||
|
||||
# fmt: off
|
||||
from dataclasses import dataclass
|
||||
|
||||
if True:
|
||||
if False:
|
||||
x: int # Optional[int]
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
source: crates/ruff_python_formatter/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/fmt_on_off/fmt_off_unclosed_trailing_comment.py
|
||||
---
|
||||
## Input
|
||||
```py
|
||||
# Regression test for https://github.com/astral-sh/ruff/issues/8211
|
||||
|
||||
# fmt: off
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class A:
|
||||
x: int # Optional[int]
|
||||
```
|
||||
|
||||
## Output
|
||||
```py
|
||||
# Regression test for https://github.com/astral-sh/ruff/issues/8211
|
||||
|
||||
# fmt: off
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class A:
|
||||
x: int # Optional[int]
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user