black/tests/data/cases/comments_in_double_parens.py
cobalt 8af439407c
fix: Don't remove comments along with parens (#4218)
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
2024-02-12 06:27:50 -08:00

114 lines
1.1 KiB
Python

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
)
):
...
# output
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
):
...