Skip to content

Commit 23c1945

Browse files
committed
Add failing test for #966
1 parent 1848c42 commit 23c1945

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

bpython/test/test_inspection.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,37 @@ def test_getfuncprops_numpy_array(self):
140140
# np.array(object, dtype=None, *, ...).
141141
self.assertEqual(props.argspec.args, ["object", "dtype"])
142142

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], [])
143174

144175
class A:
145176
a = "a"

0 commit comments

Comments
 (0)