-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac02d3a
commit 58fcd96
Showing
28 changed files
with
602 additions
and
56 deletions.
There are no files selected for viewing
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
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
1 change: 1 addition & 0 deletions
1
crates/ruff_python_formatter/resources/test/fixtures/black/cases/module_docstring_2.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
1 change: 1 addition & 0 deletions
1
...es/ruff_python_formatter/resources/test/fixtures/black/cases/module_docstring_2.py.expect
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
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
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
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 |
---|---|---|
|
@@ -79,6 +79,7 @@ def bar(a=1, b: bool = False): | |
|
||
|
||
class Baz: | ||
|
||
def __init__(self): | ||
pass | ||
|
||
|
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
4 changes: 2 additions & 2 deletions
4
crates/ruff_python_formatter/resources/test/fixtures/black/cases/preview_pep_572.py.expect
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
x[(a := 0):] | ||
x[:(a := 0)] | ||
x[(a := 0) :] | ||
x[: (a := 0)] |
119 changes: 119 additions & 0 deletions
119
...thon_formatter/tests/snapshots/black_compatibility@cases__class_blank_parentheses.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,119 @@ | ||
--- | ||
source: crates/ruff_python_formatter/tests/fixtures.rs | ||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/class_blank_parentheses.py | ||
--- | ||
## Input | ||
|
||
```python | ||
class SimpleClassWithBlankParentheses(): | ||
pass | ||
class ClassWithSpaceParentheses ( ): | ||
first_test_data = 90 | ||
second_test_data = 100 | ||
def test_func(self): | ||
return None | ||
class ClassWithEmptyFunc(object): | ||
def func_with_blank_parentheses(): | ||
return 5 | ||
def public_func_with_blank_parentheses(): | ||
return None | ||
def class_under_the_func_with_blank_parentheses(): | ||
class InsideFunc(): | ||
pass | ||
class NormalClass ( | ||
): | ||
def func_for_testing(self, first, second): | ||
sum = first + second | ||
return sum | ||
``` | ||
|
||
## Black Differences | ||
|
||
```diff | ||
--- Black | ||
+++ Ruff | ||
@@ -11,7 +11,6 @@ | ||
class ClassWithEmptyFunc(object): | ||
- | ||
def func_with_blank_parentheses(): | ||
return 5 | ||
``` | ||
|
||
## Ruff Output | ||
|
||
```python | ||
class SimpleClassWithBlankParentheses: | ||
pass | ||
class ClassWithSpaceParentheses: | ||
first_test_data = 90 | ||
second_test_data = 100 | ||
def test_func(self): | ||
return None | ||
class ClassWithEmptyFunc(object): | ||
def func_with_blank_parentheses(): | ||
return 5 | ||
def public_func_with_blank_parentheses(): | ||
return None | ||
def class_under_the_func_with_blank_parentheses(): | ||
class InsideFunc: | ||
pass | ||
class NormalClass: | ||
def func_for_testing(self, first, second): | ||
sum = first + second | ||
return sum | ||
``` | ||
|
||
## Black Output | ||
|
||
```python | ||
class SimpleClassWithBlankParentheses: | ||
pass | ||
class ClassWithSpaceParentheses: | ||
first_test_data = 90 | ||
second_test_data = 100 | ||
def test_func(self): | ||
return None | ||
class ClassWithEmptyFunc(object): | ||
def func_with_blank_parentheses(): | ||
return 5 | ||
def public_func_with_blank_parentheses(): | ||
return None | ||
def class_under_the_func_with_blank_parentheses(): | ||
class InsideFunc: | ||
pass | ||
class NormalClass: | ||
def func_for_testing(self, first, second): | ||
sum = first + second | ||
return sum | ||
``` | ||
|
||
|
Oops, something went wrong.