@@ -140,6 +140,37 @@ def test_getfuncprops_numpy_array(self):
140
140
# np.array(object, dtype=None, *, ...).
141
141
self .assertEqual (props .argspec .args , ["object" , "dtype" ])
142
142
143
+ @unittest .expectedFailure
144
+ def test_issue_966_freestanding (self ):
145
+ def fun (number , lst = []):
146
+ """
147
+ Return a list of numbers
148
+
149
+ Example:
150
+ ========
151
+ C.cmethod(1337, [1, 2]) # => [1, 2, 1337]
152
+ """
153
+ return lst + [number ]
154
+
155
+ def fun_annotations (number : int , lst : list [int ] = []) -> list [int ]:
156
+ """
157
+ Return a list of numbers
158
+
159
+ Example:
160
+ ========
161
+ C.cmethod(1337, [1, 2]) # => [1, 2, 1337]
162
+ """
163
+ return lst + [number ]
164
+
165
+ props = inspection .getfuncprops ("fun" , fun )
166
+ self .assertEqual (props .func , "fun" )
167
+ self .assertEqual (props .argspec .args , ["number" , "lst" ])
168
+ self .assertEqual (props .argspec .defaults [0 ], [])
169
+
170
+ props = inspection .getfuncprops ("fun_annotations" , fun_annotations )
171
+ self .assertEqual (props .func , "fun_annotations" )
172
+ self .assertEqual (props .argspec .args , ["number" , "lst" ])
173
+ self .assertEqual (props .argspec .defaults [0 ], [])
143
174
144
175
class A :
145
176
a = "a"
0 commit comments