mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 12:29:28 +00:00

Split out of #8044: In preview style, ellipsis are also collapsed in non-stub files. This should only affect function/class contexts since for other statements stub are generally not used. I've updated our tests to use `pass` instead to reflect this, which makes tracking the preview style changes much easier.
80 lines
1.1 KiB
Text
80 lines
1.1 KiB
Text
---
|
|
source: crates/ruff_python_formatter/tests/fixtures.rs
|
|
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/trivia.py
|
|
---
|
|
## Input
|
|
```py
|
|
|
|
# Removes the line above
|
|
|
|
a = 10 # Keeps the line above
|
|
|
|
# Separated by one line from `a` and `b`
|
|
|
|
b = 20
|
|
# Adds two lines after `b`
|
|
class Test:
|
|
def a(self):
|
|
pass
|
|
# trailing comment
|
|
|
|
# two lines before, one line after
|
|
|
|
c = 30
|
|
|
|
while a == 10:
|
|
print(a)
|
|
|
|
# trailing comment with one line before
|
|
|
|
# one line before this leading comment
|
|
|
|
d = 40
|
|
|
|
while b == 20:
|
|
print(b)
|
|
# no empty line before
|
|
|
|
e = 50 # one empty line before
|
|
```
|
|
|
|
## Output
|
|
```py
|
|
# Removes the line above
|
|
|
|
a = 10 # Keeps the line above
|
|
|
|
# Separated by one line from `a` and `b`
|
|
|
|
b = 20
|
|
|
|
|
|
# Adds two lines after `b`
|
|
class Test:
|
|
def a(self):
|
|
pass
|
|
# trailing comment
|
|
|
|
|
|
# two lines before, one line after
|
|
|
|
c = 30
|
|
|
|
while a == 10:
|
|
print(a)
|
|
|
|
# trailing comment with one line before
|
|
|
|
# one line before this leading comment
|
|
|
|
d = 40
|
|
|
|
while b == 20:
|
|
print(b)
|
|
# no empty line before
|
|
|
|
e = 50 # one empty line before
|
|
```
|
|
|
|
|
|
|