[issue12510] IDLE: calltips mishandle raw strings and other examples

Terry J. Reedy report at bugs.python.org
Tue Jun 5 11:21:08 CEST 2012


Terry J. Reedy <tjreedy at udel.edu> added the comment:

By 'Python 3 only', I meant that I am not personally planning to backport to 2.7. I do not want to edit the more complicated get_arg_text and consider other issues higher priority.
 
I meant to include a test case for callable instances, but forgot. When 
I add to test class TC
"        def __call__(self, ci): "(self, ci)"
tc( gives the inherited TC.__doc__ as the tool tip, which in this case happens to by the artificial "(ai=None, *b)".

Adding the following to get_argspec:

        # after current if is...type: fob = ...
        elif isinstance(ob.__call__, types.MethodType):
            fob = ob.__call__
&
             or isinstance(ob.__call__, types.MethodType)
        # to self-strip conditional, as instance is already typed 
&
        if isinstance(ob.__call__, types.MethodType):
            doc = ob.__call__.__doc__
        else:
          # before current doc = line, which gets indented

makes this new test pass.
        fdoc = tc.__call__.__doc__
        test('tc', fdoc + "\n" + fdoc)

Revised patch with above attached.

Note 1: Programming is more fun with decent tests.
Note 2: These non-visual automatic test do not completely substitute for visual testing with the gui. When I first used a broader conditional than the 'elif' above, one that caught list.append and [].append, the tests passed, but typing list.append( resulting in weird behavior: something flashed and the typed text moved down a line.

----------
Added file: http://bugs.python.org/file25828/i12510b.test.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12510>
_______________________________________


More information about the Python-bugs-list mailing list