Skip to content

Commit

Permalink
Update black tests (#10166)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored Feb 29, 2024
1 parent a6f32dd commit dcc92f5
Show file tree
Hide file tree
Showing 139 changed files with 5,480 additions and 1,389 deletions.
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
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
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@ def wat():
@deco2(with_args=True)
# leading 3
@deco3
def decorated1():
...
def decorated1(): ...


# leading 1
@deco1
# leading 2
@deco2(with_args=True)
# leading function comment
def decorated1():
...
def decorated1(): ...


# Note: this is fixed in
Expand All @@ -65,8 +63,7 @@ def decorated1():


# This comment should be split from `some_instruction` by two lines but isn't.
def g():
...
def g(): ...


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@ def wat():
@deco2(with_args=True)
# leading 3
@deco3
def decorated1():
...
def decorated1(): ...


# leading 1
@deco1
# leading 2
@deco2(with_args=True)
# leading function comment
def decorated1():
...
def decorated1(): ...


# Note: this is fixed in
Expand All @@ -65,8 +63,7 @@ some_instruction


# This comment should be split from `some_instruction` by two lines but isn't.
def g():
...
def g(): ...


if __name__ == "__main__":
Expand Down
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
)
):
...
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
):
...
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ def foo(wait: bool = True):
time.sleep(1) if wait else None


a = "".join((
"", # comment
"" if True else "",
))
a = "".join(
(
"", # comment
"" if True else "",
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"target_version": "py38"}
Loading

0 comments on commit dcc92f5

Please sign in to comment.