mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Update Black Tests (#9455)
This commit is contained in:
parent
ac02d3aedd
commit
58fcd96ac1
28 changed files with 602 additions and 56 deletions
|
@ -11,6 +11,7 @@ class ClassWithSpaceParentheses:
|
|||
|
||||
|
||||
class ClassWithEmptyFunc(object):
|
||||
|
||||
def func_with_blank_parentheses():
|
||||
return 5
|
||||
|
||||
|
|
|
@ -65,3 +65,25 @@ def something():
|
|||
if flat
|
||||
else ValuesListIterable
|
||||
)
|
||||
|
||||
|
||||
def foo(wait: bool = True):
|
||||
# This comment is two
|
||||
# lines long
|
||||
|
||||
# This is only one
|
||||
time.sleep(1) if wait else None
|
||||
time.sleep(1) if wait else None
|
||||
|
||||
# With newline above
|
||||
time.sleep(1) if wait else None
|
||||
# Without newline above
|
||||
time.sleep(1) if wait else None
|
||||
|
||||
|
||||
a = "".join(
|
||||
(
|
||||
"", # comment
|
||||
"" if True else "",
|
||||
)
|
||||
)
|
||||
|
|
|
@ -88,3 +88,23 @@ def something():
|
|||
if named
|
||||
else FlatValuesListIterable if flat else ValuesListIterable
|
||||
)
|
||||
|
||||
|
||||
def foo(wait: bool = True):
|
||||
# This comment is two
|
||||
# lines long
|
||||
|
||||
# This is only one
|
||||
time.sleep(1) if wait else None
|
||||
time.sleep(1) if wait else None
|
||||
|
||||
# With newline above
|
||||
time.sleep(1) if wait else None
|
||||
# Without newline above
|
||||
time.sleep(1) if wait else None
|
||||
|
||||
|
||||
a = "".join((
|
||||
"", # comment
|
||||
"" if True else "",
|
||||
))
|
||||
|
|
|
@ -5,7 +5,7 @@ def foo2(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parame
|
|||
def foo3(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
||||
def foo4(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
||||
|
||||
# Adding some unformatted code covering a wide range of syntaxes.
|
||||
# Adding some unformated code covering a wide range of syntaxes.
|
||||
|
||||
if True:
|
||||
# Incorrectly indented prefix comments.
|
||||
|
|
|
@ -28,7 +28,7 @@ def foo3(
|
|||
|
||||
def foo4(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
|
||||
|
||||
# Adding some unformatted code covering a wide range of syntaxes.
|
||||
# Adding some unformated code covering a wide range of syntaxes.
|
||||
|
||||
if True:
|
||||
# Incorrectly indented prefix comments.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""I am a very helpful module docstring.
|
||||
|
||||
With trailing spaces:
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
|
||||
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
||||
Ut enim ad minim veniam,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""I am a very helpful module docstring.
|
||||
|
||||
With trailing spaces:
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
|
||||
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
||||
Ut enim ad minim veniam,
|
||||
|
|
|
@ -16,3 +16,15 @@ if sys.version_info > (3, 7):
|
|||
def function_definition(self): ...
|
||||
assignment = 1
|
||||
def f2(self) -> str: ...
|
||||
|
||||
|
||||
class TopLevel:
|
||||
class Nested1:
|
||||
foo: int
|
||||
def bar(self): ...
|
||||
field = 1
|
||||
|
||||
class Nested2:
|
||||
def bar(self): ...
|
||||
foo: int
|
||||
field = 1
|
||||
|
|
|
@ -20,3 +20,16 @@ if sys.version_info > (3, 7):
|
|||
assignment = 1
|
||||
|
||||
def f2(self) -> str: ...
|
||||
|
||||
class TopLevel:
|
||||
class Nested1:
|
||||
foo: int
|
||||
def bar(self): ...
|
||||
|
||||
field = 1
|
||||
|
||||
class Nested2:
|
||||
def bar(self): ...
|
||||
foo: int
|
||||
|
||||
field = 1
|
||||
|
|
|
@ -19,7 +19,7 @@ z: (Short
|
|||
z: (int) = 2.3
|
||||
z: ((int)) = foo()
|
||||
|
||||
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
||||
x = (
|
||||
z
|
||||
== 9999999999999999999999999999999999999999
|
||||
|
|
|
@ -28,7 +28,7 @@ z: Short | Short2 | Short3 | Short4 = 8
|
|||
z: int = 2.3
|
||||
z: int = foo()
|
||||
|
||||
# In case I go for not enforcing parentheses, this might get improved at the same time
|
||||
# In case I go for not enforcing parantheses, this might get improved at the same time
|
||||
x = (
|
||||
z
|
||||
== 9999999999999999999999999999999999999999
|
||||
|
|
|
@ -60,3 +60,23 @@ 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
|
||||
|
|
|
@ -57,6 +57,25 @@ def quux():
|
|||
|
||||
|
||||
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
|
||||
|
|
|
@ -56,3 +56,14 @@ if some_condition:
|
|||
...
|
||||
|
||||
if already_dummy: ...
|
||||
|
||||
class AsyncCls:
|
||||
async def async_method(self):
|
||||
...
|
||||
|
||||
async def async_function(self):
|
||||
...
|
||||
|
||||
@decorated
|
||||
async def async_function(self):
|
||||
...
|
||||
|
|
|
@ -59,3 +59,14 @@ if some_condition:
|
|||
|
||||
if already_dummy:
|
||||
...
|
||||
|
||||
|
||||
class AsyncCls:
|
||||
async def async_method(self): ...
|
||||
|
||||
|
||||
async def async_function(self): ...
|
||||
|
||||
|
||||
@decorated
|
||||
async def async_function(self): ...
|
||||
|
|
|
@ -79,6 +79,7 @@ def bar(a=1, b: bool = False):
|
|||
|
||||
|
||||
class Baz:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
|
|
@ -27,3 +27,7 @@ class MultilineDocstringsAsWell:
|
|||
|
||||
and on so many lines...
|
||||
"""
|
||||
|
||||
class SingleQuotedDocstring:
|
||||
|
||||
"I'm a docstring but I don't even get triple quotes."
|
||||
|
|
|
@ -22,3 +22,7 @@ class MultilineDocstringsAsWell:
|
|||
|
||||
and on so many lines...
|
||||
"""
|
||||
|
||||
|
||||
class SingleQuotedDocstring:
|
||||
"I'm a docstring but I don't even get triple quotes."
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
x[(a := 0):]
|
||||
x[:(a := 0)]
|
||||
x[(a := 0) :]
|
||||
x[: (a := 0)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue