Debian Codegraph @

tests/data/miscellaneous/decorators.py

raw
1 # This file doesn't use the standard decomposition.
2 # Decorator syntax test cases are separated by double # comments.
3 # Those before the 'output' comment are valid under the old syntax.
4 # Those after the 'ouput' comment require PEP614 relaxed syntax.
5 # Do not remove the double # separator before the first test case, it allows
6 # the comment before the test case to be ignored.
7
8 ##
9
10 @decorator
11 def f():
12 ...
13
14 ##
15
16 @decorator()
17 def f():
18 ...
19
20 ##
21
22 @decorator(arg)
23 def f():
24 ...
25
26 ##
27
28 @decorator(kwarg=0)
29 def f():
30 ...
31
32 ##
33
34 @decorator(*args)
35 def f():
36 ...
37
38 ##
39
40 @decorator(**kwargs)
41 def f():
42 ...
43
44 ##
45
46 @decorator(*args, **kwargs)
47 def f():
48 ...
49
50 ##
51
52 @decorator(*args, **kwargs,)
53 def f():
54 ...
55
56 ##
57
58 @dotted.decorator
59 def f():
60 ...
61
62 ##
63
64 @dotted.decorator(arg)
65 def f():
66 ...
67
68 ##
69
70 @dotted.decorator(kwarg=0)
71 def f():
72 ...
73
74 ##
75
76 @dotted.decorator(*args)
77 def f():
78 ...
79
80 ##
81
82 @dotted.decorator(**kwargs)
83 def f():
84 ...
85
86 ##
87
88 @dotted.decorator(*args, **kwargs)
89 def f():
90 ...
91
92 ##
93
94 @dotted.decorator(*args, **kwargs,)
95 def f():
96 ...
97
98 ##
99
100 @double.dotted.decorator
101 def f():
102 ...
103
104 ##
105
106 @double.dotted.decorator(arg)
107 def f():
108 ...
109
110 ##
111
112 @double.dotted.decorator(kwarg=0)
113 def f():
114 ...
115
116 ##
117
118 @double.dotted.decorator(*args)
119 def f():
120 ...
121
122 ##
123
124 @double.dotted.decorator(**kwargs)
125 def f():
126 ...
127
128 ##
129
130 @double.dotted.decorator(*args, **kwargs)
131 def f():
132 ...
133
134 ##
135
136 @double.dotted.decorator(*args, **kwargs,)
137 def f():
138 ...
139
140 ##
141
142 @_(sequence["decorator"])
143 def f():
144 ...
145
146 ##
147
148 @eval("sequence['decorator']")
149 def f():
150 ...
151
152 # output
153
154 ##
155
156 @decorator()()
157 def f():
158 ...
159
160 ##
161
162 @(decorator)
163 def f():
164 ...
165
166 ##
167
168 @sequence["decorator"]
169 def f():
170 ...
171
172 ##
173
174 @decorator[List[str]]
175 def f():
176 ...
177
178 ##
179
180 @var := decorator
181 def f():
182 ...