-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use one line between top-level items if formatting a stub file (#6501)
Co-authored-by: Micha Reiser <micha@reiser.io>
- Loading branch information
1 parent
455db84
commit 84d178a
Showing
7 changed files
with
451 additions
and
2 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/top_level.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
class A: | ||
def __init__(self): | ||
pass | ||
|
||
class B: | ||
def __init__(self): | ||
pass | ||
|
||
def foo(): | ||
pass | ||
|
||
class Del(expr_context): ... | ||
class Load(expr_context): ... | ||
|
||
# Some comment. | ||
class Other(expr_context): ... | ||
class Store(expr_context): ... | ||
class Foo(Bar): ... | ||
|
||
class Baz(Qux): | ||
def __init__(self): | ||
pass | ||
|
||
class Quux(Qux): | ||
def __init__(self): | ||
pass | ||
|
||
# Some comment. | ||
class Quuz(Qux): | ||
def __init__(self): | ||
pass | ||
|
||
def bar(): ... | ||
def baz(): ... | ||
def quux(): | ||
"""Some docstring.""" | ||
|
||
def quuz(): | ||
"""Some docstring.""" |
78 changes: 78 additions & 0 deletions
78
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/top_level.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
class A: | ||
def __init__(self): | ||
pass | ||
|
||
|
||
class B: | ||
def __init__(self): | ||
pass | ||
|
||
|
||
def foo(): | ||
pass | ||
|
||
|
||
class Del(expr_context): | ||
... | ||
|
||
|
||
class Load(expr_context): | ||
... | ||
|
||
|
||
# Some comment. | ||
class Other(expr_context): | ||
... | ||
|
||
|
||
class Store(expr_context): | ||
... | ||
|
||
|
||
class Foo(Bar): | ||
... | ||
|
||
|
||
class Baz(Qux): | ||
def __init__(self): | ||
pass | ||
|
||
|
||
class Quux(Qux): | ||
def __init__(self): | ||
pass | ||
|
||
|
||
# Some comment. | ||
class Quuz(Qux): | ||
def __init__(self): | ||
pass | ||
|
||
|
||
def bar(): | ||
... | ||
|
||
|
||
def baz(): | ||
... | ||
|
||
|
||
def quux(): | ||
"""Some docstring.""" | ||
|
||
|
||
def quuz(): | ||
"""Some docstring.""" | ||
|
||
def a(): | ||
... | ||
|
||
class Test: | ||
... | ||
|
||
class Test2(A): | ||
... | ||
|
||
def b(): ... | ||
# comment | ||
def c(): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
crates/ruff_python_formatter/tests/snapshots/format@statement__top_level.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
--- | ||
source: crates/ruff_python_formatter/tests/fixtures.rs | ||
input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/top_level.py | ||
--- | ||
## Input | ||
```py | ||
class A: | ||
def __init__(self): | ||
pass | ||
class B: | ||
def __init__(self): | ||
pass | ||
def foo(): | ||
pass | ||
class Del(expr_context): ... | ||
class Load(expr_context): ... | ||
# Some comment. | ||
class Other(expr_context): ... | ||
class Store(expr_context): ... | ||
class Foo(Bar): ... | ||
class Baz(Qux): | ||
def __init__(self): | ||
pass | ||
class Quux(Qux): | ||
def __init__(self): | ||
pass | ||
# Some comment. | ||
class Quuz(Qux): | ||
def __init__(self): | ||
pass | ||
def bar(): ... | ||
def baz(): ... | ||
def quux(): | ||
"""Some docstring.""" | ||
def quuz(): | ||
"""Some docstring.""" | ||
``` | ||
|
||
## Output | ||
```py | ||
class A: | ||
def __init__(self): | ||
pass | ||
class B: | ||
def __init__(self): | ||
pass | ||
def foo(): | ||
pass | ||
class Del(expr_context): | ||
... | ||
class Load(expr_context): | ||
... | ||
# Some comment. | ||
class Other(expr_context): | ||
... | ||
class Store(expr_context): | ||
... | ||
class Foo(Bar): | ||
... | ||
class Baz(Qux): | ||
def __init__(self): | ||
pass | ||
class Quux(Qux): | ||
def __init__(self): | ||
pass | ||
# Some comment. | ||
class Quuz(Qux): | ||
def __init__(self): | ||
pass | ||
def bar(): | ||
... | ||
def baz(): | ||
... | ||
def quux(): | ||
"""Some docstring.""" | ||
def quuz(): | ||
"""Some docstring.""" | ||
``` | ||
|
||
|
||
|
Oops, something went wrong.