Debian Codegraph @

tests/data/cases/pattern_matching_style.py

raw
1 # flags: --minimum-version=3.10
2 match something:
3 case b(): print(1+1)
4 case c(
5 very_complex=True,
6 perhaps_even_loooooooooooooooooooooooooooooooooooooong=- 1
7 ): print(1)
8 case c(
9 very_complex=True,
10 perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1,
11 ): print(2)
12 case a: pass
13
14 match(
15 arg # comment
16 )
17
18 match(
19 )
20
21 match(
22
23
24 )
25
26 case(
27 arg # comment
28 )
29
30 case(
31 )
32
33 case(
34
35
36 )
37
38
39 re.match(
40 something # fast
41 )
42 re.match(
43
44
45
46 )
47 match match(
48
49
50 ):
51 case case(
52 arg, # comment
53 ):
54 pass
55
56 # output
57
58 match something:
59 case b():
60 print(1 + 1)
61 case c(
62 very_complex=True, perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1
63 ):
64 print(1)
65 case c(
66 very_complex=True,
67 perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1,
68 ):
69 print(2)
70 case a:
71 pass
72
73 match(arg) # comment
74
75 match()
76
77 match()
78
79 case(arg) # comment
80
81 case()
82
83 case()
84
85
86 re.match(something) # fast
87 re.match()
88 match match():
89 case case(
90 arg, # comment
91 ):
92 pass