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.
336 lines
2.3 KiB
Plaintext
336 lines
2.3 KiB
Plaintext
---
|
|
source: crates/ruff_python_formatter/tests/fixtures.rs
|
|
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/newlines.pyi
|
|
---
|
|
## Input
|
|
```python
|
|
###
|
|
# Blank lines around functions
|
|
###
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
|
|
if True:
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
|
|
x = 1
|
|
|
|
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
|
|
x = 1
|
|
|
|
|
|
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
|
|
x = 1
|
|
|
|
|
|
# comment
|
|
|
|
|
|
|
|
# comment
|
|
|
|
|
|
|
|
def f():
|
|
pass
|
|
# comment
|
|
|
|
|
|
def f():
|
|
pass
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
|
|
# comment
|
|
|
|
###
|
|
# Blank lines around imports.
|
|
###
|
|
|
|
def f():
|
|
import x
|
|
# comment
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x
|
|
# comment
|
|
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x
|
|
# comment
|
|
|
|
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x
|
|
|
|
|
|
# comment
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
|
|
import y
|
|
|
|
|
|
def f():
|
|
import x # comment
|
|
# comment
|
|
|
|
import y
|
|
|
|
|
|
def f(): pass # comment
|
|
# comment
|
|
|
|
x = 1
|
|
|
|
|
|
def f():
|
|
pass
|
|
|
|
|
|
if True:
|
|
def a():
|
|
return 1
|
|
else:
|
|
pass
|
|
|
|
|
|
# comment
|
|
|
|
x = 1
|
|
|
|
```
|
|
|
|
## Output
|
|
```python
|
|
###
|
|
# Blank lines around functions
|
|
###
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
if True:
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
# comment
|
|
def f():
|
|
pass
|
|
|
|
x = 1
|
|
|
|
# comment
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
# comment
|
|
|
|
def f():
|
|
pass
|
|
|
|
# comment
|
|
|
|
###
|
|
# Blank lines around imports.
|
|
###
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
import y
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
import y
|
|
|
|
def f():
|
|
import x
|
|
# comment
|
|
|
|
import y
|
|
|
|
def f():
|
|
import x
|
|
# comment
|
|
|
|
import y
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
import y
|
|
|
|
def f():
|
|
import x
|
|
|
|
# comment
|
|
|
|
import y
|
|
|
|
def f():
|
|
import x # comment
|
|
# comment
|
|
|
|
import y
|
|
|
|
def f():
|
|
pass # comment
|
|
|
|
# comment
|
|
|
|
x = 1
|
|
|
|
def f():
|
|
pass
|
|
|
|
if True:
|
|
def a():
|
|
return 1
|
|
else:
|
|
pass
|
|
|
|
# comment
|
|
|
|
x = 1
|
|
```
|
|
|
|
|
|
## Preview changes
|
|
```diff
|
|
--- Stable
|
|
+++ Preview
|
|
@@ -134,6 +134,7 @@
|
|
if True:
|
|
def a():
|
|
return 1
|
|
+
|
|
else:
|
|
pass
|
|
|
|
```
|