-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
T: bugSomething isn't workingSomething isn't working
Description
Describe the bug
When trying to run black
on a file with a patter matching block where a case is a class
pattern with an as
pattern inside of it fails to format
To Reproduce
For example, take this code:
A stripped down example of file that was failing
from collections.abc import Callable
class Foo:
bb = 5
def aa(self):
...
bar1 = Foo()
match bar1:
case Foo(aa=Callable() as aa, bb=int()):
print(bar1.aa, bar1.bb)
case _:
print("no match", "\n")
And run it with these arguments:
$ black file.py --target-version=py310
The resulting error is:
error: cannot format test.py: Cannot parse: 14:27: case Foo(aa=Callable() as aa, bb=int()):
Oh no! 💥 💔 💥
1 file failed to reformat.
Expected behavior
Expected not to fail
Environment
RHEL7
python 3.10.1
black 21.12b0
Metadata
Metadata
Assignees
Labels
T: bugSomething isn't workingSomething isn't working