Terry J. Reedy <[email protected]> added the comment:
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.
----------
Added file: http://bugs.python.org/file25836/i12510c.test.diff
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12510>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com