-
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
a6f32dd
commit dcc92f5
Showing
139 changed files
with
5,480 additions
and
1,389 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
crates/ruff_python_formatter/resources/test/fixtures/black/cases/allow_empty_first_line.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,82 @@ | ||
def foo(): | ||
""" | ||
Docstring | ||
""" | ||
|
||
# Here we go | ||
if x: | ||
|
||
# This is also now fine | ||
a = 123 | ||
|
||
else: | ||
# But not necessary | ||
a = 123 | ||
|
||
if y: | ||
|
||
while True: | ||
|
||
""" | ||
Long comment here | ||
""" | ||
a = 123 | ||
|
||
if z: | ||
|
||
for _ in range(100): | ||
a = 123 | ||
else: | ||
|
||
try: | ||
|
||
# this should be ok | ||
a = 123 | ||
except: | ||
|
||
"""also this""" | ||
a = 123 | ||
|
||
|
||
def bar(): | ||
|
||
if x: | ||
a = 123 | ||
|
||
|
||
def baz(): | ||
|
||
# OK | ||
if x: | ||
a = 123 | ||
|
||
def quux(): | ||
|
||
new_line = here | ||
|
||
|
||
class Cls: | ||
|
||
def method(self): | ||
|
||
pass | ||
|
||
|
||
async def async_fn(): | ||
|
||
"""Docstring.""" | ||
|
||
|
||
@decorated | ||
async def async_fn(): | ||
|
||
"""Docstring.""" | ||
|
||
|
||
def top_level( | ||
a: int, | ||
b: str, | ||
) -> Whatever[Generic, Something]: | ||
|
||
def nested(x: int) -> int: | ||
pass |
81 changes: 81 additions & 0 deletions
81
...uff_python_formatter/resources/test/fixtures/black/cases/allow_empty_first_line.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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
def foo(): | ||
""" | ||
Docstring | ||
""" | ||
|
||
# Here we go | ||
if x: | ||
|
||
# This is also now fine | ||
a = 123 | ||
|
||
else: | ||
# But not necessary | ||
a = 123 | ||
|
||
if y: | ||
|
||
while True: | ||
|
||
""" | ||
Long comment here | ||
""" | ||
a = 123 | ||
|
||
if z: | ||
|
||
for _ in range(100): | ||
a = 123 | ||
else: | ||
|
||
try: | ||
|
||
# this should be ok | ||
a = 123 | ||
except: | ||
|
||
"""also this""" | ||
a = 123 | ||
|
||
|
||
def bar(): | ||
|
||
if x: | ||
a = 123 | ||
|
||
|
||
def baz(): | ||
|
||
# OK | ||
if x: | ||
a = 123 | ||
|
||
|
||
def quux(): | ||
|
||
new_line = here | ||
|
||
|
||
class Cls: | ||
|
||
def method(self): | ||
|
||
pass | ||
|
||
|
||
async def async_fn(): | ||
"""Docstring.""" | ||
|
||
|
||
@decorated | ||
async def async_fn(): | ||
"""Docstring.""" | ||
|
||
|
||
def top_level( | ||
a: int, | ||
b: str, | ||
) -> Whatever[Generic, Something]: | ||
|
||
def nested(x: int) -> int: | ||
pass |
11 changes: 11 additions & 0 deletions
11
crates/ruff_python_formatter/resources/test/fixtures/black/cases/async_stmts.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,11 @@ | ||
async def func() -> (int): | ||
return 0 | ||
|
||
|
||
@decorated | ||
async def func() -> (int): | ||
return 0 | ||
|
||
|
||
async for (item) in async_iter: | ||
pass |
11 changes: 11 additions & 0 deletions
11
crates/ruff_python_formatter/resources/test/fixtures/black/cases/async_stmts.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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
async def func() -> int: | ||
return 0 | ||
|
||
|
||
@decorated | ||
async def func() -> int: | ||
return 0 | ||
|
||
|
||
async for item in async_iter: | ||
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
56 changes: 56 additions & 0 deletions
56
...es/ruff_python_formatter/resources/test/fixtures/black/cases/comments_in_double_parens.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,56 @@ | ||
if ( | ||
True | ||
# sdf | ||
): | ||
print("hw") | ||
|
||
if (( | ||
True | ||
# sdf | ||
)): | ||
print("hw") | ||
|
||
if (( | ||
# type: ignore | ||
True | ||
)): | ||
print("hw") | ||
|
||
if (( | ||
True | ||
# type: ignore | ||
)): | ||
print("hw") | ||
|
||
if ( | ||
# a long comment about | ||
# the condition below | ||
(a or b) | ||
): | ||
pass | ||
|
||
def return_true(): | ||
return ( | ||
( | ||
True # this comment gets removed accidentally | ||
) | ||
) | ||
|
||
def return_true(): | ||
return (True) # this comment gets removed accidentally | ||
|
||
|
||
if ( | ||
# huh comment | ||
(True) | ||
): | ||
... | ||
|
||
if ( | ||
# huh | ||
( | ||
# comment | ||
True | ||
) | ||
): | ||
... |
53 changes: 53 additions & 0 deletions
53
..._python_formatter/resources/test/fixtures/black/cases/comments_in_double_parens.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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
if ( | ||
True | ||
# sdf | ||
): | ||
print("hw") | ||
|
||
if ( | ||
True | ||
# sdf | ||
): | ||
print("hw") | ||
|
||
if ( | ||
# type: ignore | ||
True | ||
): | ||
print("hw") | ||
|
||
if ( | ||
True | ||
# type: ignore | ||
): | ||
print("hw") | ||
|
||
if ( | ||
# a long comment about | ||
# the condition below | ||
a | ||
or b | ||
): | ||
pass | ||
|
||
|
||
def return_true(): | ||
return True # this comment gets removed accidentally | ||
|
||
|
||
def return_true(): | ||
return True # this comment gets removed accidentally | ||
|
||
|
||
if ( | ||
# huh comment | ||
True | ||
): | ||
... | ||
|
||
if ( | ||
# huh | ||
# comment | ||
True | ||
): | ||
... |
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
...uff_python_formatter/resources/test/fixtures/black/cases/context_managers_38.options.json
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 @@ | ||
{"target_version": "py38"} |
Oops, something went wrong.