Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move CallTips tests to idle_tests #64321

Closed
serhiy-storchaka opened this issue Jan 4, 2014 · 6 comments
Closed

Move CallTips tests to idle_tests #64321

serhiy-storchaka opened this issue Jan 4, 2014 · 6 comments
Assignees
Labels
tests Tests in the Lib/test dir topic-IDLE type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 20122
Nosy @terryjreedy, @kbkaiser, @serwy, @serhiy-storchaka
Files
  • test_calltips.patch
  • test_calltips-33.diff
  • test_calltips-27.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2014-01-21.05:32:33.835>
    created_at = <Date 2014-01-04.16:24:58.462>
    labels = ['expert-IDLE', 'type-feature', 'tests']
    title = 'Move CallTips tests to idle_tests'
    updated_at = <Date 2014-01-21.05:32:33.835>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2014-01-21.05:32:33.835>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2014-01-21.05:32:33.835>
    closer = 'terry.reedy'
    components = ['IDLE', 'Tests']
    creation = <Date 2014-01-04.16:24:58.462>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['33308', '33536', '33543']
    hgrepos = []
    issue_num = 20122
    keywords = ['patch']
    message_count = 6.0
    messages = ['207291', '207363', '207816', '208433', '208454', '208615']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'kbk', 'roger.serwy', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue20122'
    versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']

    @serhiy-storchaka
    Copy link
    Member Author

    Proposed patch moves CallTips tests from Lib/idlelib/CallTips.py to Lib/idlelib/idle_test/test_calltips.py and converts them to unittests.

    Private keyword-only parameter _namespace was added to fetch_tip() and get_entity().

    @serhiy-storchaka serhiy-storchaka added topic-IDLE tests Tests in the Lib/test dir type-feature A feature request or enhancement labels Jan 4, 2014
    @terryjreedy
    Copy link
    Member

    It is a good idea to make this a separate patch;-). Will look carefully after sleep.

    @terryjreedy terryjreedy self-assigned this Jan 5, 2014
    @terryjreedy
    Copy link
    Member

    The existing tests in CallTips.py, half of which I wrote based on the ones that existed, have one or two deficiencies that are copied in the patch.

    First, they are not proper unittests. They test get_argspec indirectly by calling .fetch_tip and get_entity. This lead to the new private parameter, which will not be needed for the existing tests when get_argspec is called directly with objects.

    Adding more tests for get_entity, beyond the one in test_calltips.py already, is a different issue. The function is mostly a wrapper for eval(), which we may assume works correctly.

    Second, the doubling resulting from putting expected output in docstrings seems a bit flakey. It certainly does not test cases with no docstring or multiple-line docstrings.

    I am working on a revised patch. (Also, the unittest call was added with test_calltip.py and I want it left.)

    In 2.7. get_argspec is get_arg_text, with a different implementation. Backporting to 2.7 will require some adjustments.

    @terryjreedy
    Copy link
    Member

    Attached patch moves all tests, changed (and simplified) to call get_argspec directly. I will apply after I get tk 8.6 to test with 3.4.

    @terryjreedy
    Copy link
    Member

    Attached is patch for 2.7 with all tests passing. 3.x get_argspec cannot replace 2.x get_arg_text because it uses inspect.getfullargspec, which does not exist in 2.7. (Its use made the code simpler.) Besides minor changes in test_calltips.py, I made 3 changes to get_arg_text() to get tests to pass.

    1. Stop deleting first parameter for unbound methods (bugfix).
    2. Replace class instances with __call__ methods (bugfix).
    3. Change tip for def f(*some_name, **other_name) from '(..., ***)' to '(*args, **kwds)'. 2.7 either does not keep the dummy names, which anyway cannot be used when calling , or the current code makes no effort to retrieve them.

    My reasons for 3. are that the replacement is a) the current convention everywhere else, b) more like the corresponding 3.x tip (which has the exact names), and c) more indicative of what one actually writes in a call.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jan 21, 2014

    New changeset f6f2d9d04cd0 by Terry Jan Reedy in branch '2.7':
    Issue bpo-20122: Idlelib: Move tests in 3.x CallTips.py to test_calltips.py.
    http://hg.python.org/cpython/rev/f6f2d9d04cd0

    New changeset 7befcc353d40 by Terry Jan Reedy in branch '3.3':
    Issue bpo-20122: Idlelib: Move tests in CallTips.py to test_calltips.py.
    http://hg.python.org/cpython/rev/7befcc353d40

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir topic-IDLE type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants