File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 29
29
def getAlternatives (n ):
30
30
if isinstance (n , ast .If ):
31
31
return [n .body ]
32
- if isinstance (n , ast .Try ):
32
+ elif isinstance (n , ast .Try ):
33
33
return [n .body + n .orelse ] + [[hdl ] for hdl in n .handlers ]
34
+ elif sys .version_info >= (3 , 10 ) and isinstance (n , ast .Match ):
35
+ return [mc .body for mc in n .cases ]
34
36
35
37
36
38
FOR_TYPES = (ast .For , ast .AsyncFor )
Original file line number Diff line number Diff line change @@ -81,3 +81,14 @@ def test_match_double_star(self):
81
81
case {'foo': k1, **rest}:
82
82
print(f'{k1=} {rest=}')
83
83
''' )
84
+
85
+ def test_defined_in_different_branches (self ):
86
+ self .flakes ('''
87
+ def f(x):
88
+ match x:
89
+ case 1:
90
+ def y(): pass
91
+ case _:
92
+ def y(): print(1)
93
+ return y
94
+ ''' )
You can’t perform that action at this time.
0 commit comments