Debian Codegraph @

tests/data/cases/pattern_matching_with_if_stmt.py

raw
1 # flags: --minimum-version=3.10
2 match match:
3 case "test" if case != "not very loooooooooooooog condition": # comment
4 pass
5
6 match smth:
7 case "test" if "any long condition" != "another long condition" and "this is a long condition":
8 pass
9 case test if "any long condition" != "another long condition" and "this is a looooong condition":
10 pass
11 case test if "any long condition" != "another long condition" and "this is a looooong condition": # some additional comments
12 pass
13 case test if (True): # some comment
14 pass
15 case test if (False
16 ): # some comment
17 pass
18 case test if (True # some comment
19 ):
20 pass # some comment
21 case cases if (True # some comment
22 ): # some other comment
23 pass # some comment
24 case match if (True # some comment
25 ):
26 pass # some comment
27
28 # case black_test_patma_052 (originally in the pattern_matching_complex test case)
29 match x:
30 case [1, 0] if x := x[:0]:
31 y = 1
32 case [1, 0] if (x := x[:0]):
33 y = 1
34
35 # output
36
37 match match:
38 case "test" if case != "not very loooooooooooooog condition": # comment
39 pass
40
41 match smth:
42 case "test" if (
43 "any long condition" != "another long condition" and "this is a long condition"
44 ):
45 pass
46 case test if (
47 "any long condition" != "another long condition"
48 and "this is a looooong condition"
49 ):
50 pass
51 case test if (
52 "any long condition" != "another long condition"
53 and "this is a looooong condition"
54 ): # some additional comments
55 pass
56 case test if True: # some comment
57 pass
58 case test if False: # some comment
59 pass
60 case test if True: # some comment
61 pass # some comment
62 case cases if True: # some comment # some other comment
63 pass # some comment
64 case match if True: # some comment
65 pass # some comment
66
67 # case black_test_patma_052 (originally in the pattern_matching_complex test case)
68 match x:
69 case [1, 0] if x := x[:0]:
70 y = 1
71 case [1, 0] if x := x[:0]:
72 y = 1