GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improve `test_inspect` · Issue #103553 · python/cpython

Improve test_inspect #103553

New issue
Copy link
New issue
Copy link
Closed
Closed
Improve test_inspect#103553
Copy link
Assignees
sobolevn
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@sobolevn
sobolevn
opened on Apr 15, 2023
Issue body actions

While working on #103406 I've noticed that there are some problems with test_inspect that we can easily fix.

List of problems I found:

  1. cpython/Lib/test/test_inspect.py

    Lines 1840 to 1845 in 2b6f5c3

    f3 = self.makeCallable('**c')
    self.assertEqualException(f3, '1, 2')
    self.assertEqualException(f3, '1, 2, a=1, b=2')
    f4 = self.makeCallable('*, a, b=0')
    self.assertEqualException(f3, '1, 2')
    self.assertEqualException(f3, '1, 2, a=1, b=2')
    Here f4 is not ever used, but f3 has duplicate asserts. It looks like a copy-paste error to me. I propose to add asserts for f4 as well
  2. cpython/Lib/test/test_inspect.py

    Lines 1835 to 1838 in 2b6f5c3

    # XXX: Python inconsistency
    # - for functions and bound methods: unexpected keyword 'c'
    # - for unbound methods: multiple values for keyword 'a'
    #self.assertEqualException(f, '1, c=3, a=2')
    Unbound methods do not exist anymore, so this comment is outdated. Probably, it should be removed and assert should be restored
  3. cpython/Lib/test/test_inspect.py

    Lines 1823 to 1824 in 2b6f5c3

    # XXX: success of this one depends on dict order
    ## self.assertEqualException(f, '2, 3, 4, a=1, c=5')
    It says that the result depends on the dict order. But, dicts are ordered now. Let's see if that possible to uncomment / modernize this test somehow
  4. cpython/Lib/test/test_inspect.py

    Line 2991 in 2b6f5c3

    psig = inspect.signature(partial(partial(test, 1), 2))
    This variable is not needed, because it is not used and there's an identical test right above it:

    cpython/Lib/test/test_inspect.py

    Lines 2987 to 2989 in 2b6f5c3

    self.assertEqual(self.signature(partial(partial(test, 1), 2)),
    ((('c', ..., int, "positional_or_keyword"),),
    42))
  5. There are also several unsused variables that can be removed durin this cleanup

Here's my PR :)

Linked PRs

  • gh-103553: Improve test_inspect: add more assertions, remove unused #103554
  • [3.11] gh-103553: Improve test_inspect: add more assertions, remove unused (GH-103554) #103568

Activity

  1. sobolevn
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    testsTests in the Lib/test dirTests in the Lib/test dir
    on Apr 15, 2023
  2. sobolevn
    added a commit that references this issue on Apr 15, 2023

    pythongh-103553: Improve `test_inspect`: add more assertions, remove …

    4c3f7e2
  3. sobolevn
    self-assigned this
    on Apr 15, 2023
  4. hauntsaninja
    added a commit that references this issue on Apr 15, 2023

    gh-103553: Improve `test_inspect`: add more assertions, remove unused (…

    4fe1c4b
  5. miss-islington
    added 2 commits that reference this issue on Apr 15, 2023

    pythongh-103553: Improve `test_inspect`: add more assertions, remove …

    7a6d6dc

    gh-103553: Improve `test_inspect`: add more assertions, remove unused (…

    9f3f109
  6. sobolevn
    closed this as completedon Apr 16, 2023
  7. carljm
    added 2 commits that reference this issue on Apr 17, 2023

    Merge branch 'main' into superopt

    5136459

    Merge branch 'superopt' into superopt_spec

    079c65a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @sobolevn
    sobolevn

Labels

testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.