mirror of
https://github.com/astral-sh/ruff
synced 2026-01-22 14:00:51 -05:00
Snapshot tests recently started reporting this warning: > Snapshot test passes but the existing value is in a legacy format. > Please run cargo insta test --force-update-snapshots to update to a > newer format. This PR is the result of that forced update. One file (crates/ruff_db/src/diagnostic/render/full.rs) seems to get corrupted, because it contains strings with unprintable characters that trigger some bug in cargo-insta. I've manually reverted that file, and also manually reverted the `input_file:` lines, which we like.
78 lines
1.1 KiB
Plaintext
78 lines
1.1 KiB
Plaintext
---
|
|
source: crates/ruff_python_formatter/tests/fixtures.rs
|
|
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/trivia.py
|
|
---
|
|
## Input
|
|
```python
|
|
|
|
# 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
|
|
```python
|
|
# 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
|
|
```
|