-
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.
Prefer breaking return-type over parameters
- Loading branch information
1 parent
5b500b8
commit 0c27a95
Showing
6 changed files
with
387 additions
and
55 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
73 changes: 73 additions & 0 deletions
73
..._formatter/tests/snapshots/black_compatibility@cases__typed_params_trailing_comma.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,73 @@ | ||
--- | ||
source: crates/ruff_python_formatter/tests/fixtures.rs | ||
input_file: crates/ruff_python_formatter/resources/test/fixtures/black/cases/typed_params_trailing_comma.py | ||
snapshot_kind: text | ||
--- | ||
## Input | ||
|
||
```python | ||
def long_function_name_goes_here( | ||
x: Callable[List[int]] | ||
) -> Union[List[int], float, str, bytes, Tuple[int]]: | ||
pass | ||
def long_function_name_goes_here( | ||
x: Callable[[str, Any], int] | ||
) -> Union[List[int], float, str, bytes, Tuple[int]]: | ||
pass | ||
``` | ||
|
||
## Black Differences | ||
|
||
```diff | ||
--- Black | ||
+++ Ruff | ||
@@ -1,10 +1,10 @@ | ||
-def long_function_name_goes_here( | ||
- x: Callable[List[int]], | ||
-) -> Union[List[int], float, str, bytes, Tuple[int]]: | ||
+def long_function_name_goes_here(x: Callable[List[int]]) -> Union[ | ||
+ List[int], float, str, bytes, Tuple[int] | ||
+]: | ||
pass | ||
-def long_function_name_goes_here( | ||
- x: Callable[[str, Any], int], | ||
-) -> Union[List[int], float, str, bytes, Tuple[int]]: | ||
+def long_function_name_goes_here(x: Callable[[str, Any], int]) -> Union[ | ||
+ List[int], float, str, bytes, Tuple[int] | ||
+]: | ||
pass | ||
``` | ||
|
||
## Ruff Output | ||
|
||
```python | ||
def long_function_name_goes_here(x: Callable[List[int]]) -> Union[ | ||
List[int], float, str, bytes, Tuple[int] | ||
]: | ||
pass | ||
def long_function_name_goes_here(x: Callable[[str, Any], int]) -> Union[ | ||
List[int], float, str, bytes, Tuple[int] | ||
]: | ||
pass | ||
``` | ||
|
||
## Black Output | ||
|
||
```python | ||
def long_function_name_goes_here( | ||
x: Callable[List[int]], | ||
) -> Union[List[int], float, str, bytes, Tuple[int]]: | ||
pass | ||
def long_function_name_goes_here( | ||
x: Callable[[str, Any], int], | ||
) -> Union[List[int], float, str, bytes, Tuple[int]]: | ||
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
Oops, something went wrong.