Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update black tests #10166

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"}