Message162373
The weird behavior was as if the cursor were moved to the beginning of the line and <Enter> pressed. I cannot duplicate it. I had
elif not isinstance(ob, (types.FunctionType, types.MethodType)):
instead
elif isinstance(ob.__call__, types.MethodType):
but something else must have been different, as list.append( works now with above changed back. The tests pass because passing fob to inspect is guarded. But the correct conditional is needed anyway elsewhere in the file. So I will forget this until it happens again ;-).
Since we (intend to) inspect all Python-coded callables, and since that returns at least '()' for no args (there is already a test for that), empty callable argspec should only happen for builtin and extension callables with no docstring. I added this code:
_default_callable_argspec = "No docstring, see docs."
# before get_argspec
if not argspec:
argspec = _default_callable_argspec
I added tests for this and for subclasses of builtins and uploaded a new patch. Can you think of anything else to test?
Now that the code and test cases seem about settled, the other (big) change I would like to make is to make most of the tests into proper unittests of get_argspec (which means passing an object, not a string) and some (with some overlap) into unittests of get_entity (passing expression string, getting object). Since rpcclt is None when tests call CallTips.fetch_tip, the method reduces to get_argspec(get_entity(expression)), which just mixes tests of the two functions together. |
|
Date |
User |
Action |
Args |
2012-06-05 21:06:54 | terry.reedy | set | recipients:
+ terry.reedy, ned.deily, roger.serwy, python-dev, Roy.Fox |
2012-06-05 21:06:53 | terry.reedy | set | messageid: <1338930413.48.0.498098797672.issue12510@psf.upfronthosting.co.za> |
2012-06-05 21:06:52 | terry.reedy | link | issue12510 messages |
2012-06-05 21:06:51 | terry.reedy | create | |
|