Skip to content

Lib/tests/list_tests.py is missing type2test in a few methods #138584

Closed

Description

@larryhastings

Bug report

Bug description:

There's almost no documentation for the file Lib/tests/list_tests.py. But I infer from context that it's a suite of tests for list-like objects--not just list, but types.UserList and so on. (I assumed collections.deque would take advantage of this... but it doesn't, huh.)

To use, you define a subclass of list_tests.CommonTest that defines a type2test method which converts an iterable into an object of your type, and run the tests in that object. Then, all the tests in that class use that callable to create the objects they test against.

Or... nearly all. There are (at least) three methods that don't call self.type2test; they only test against list objects. The three methods I found.

  • CommonTest.test_getitem_error
  • CommonTest.test_setitem_error
  • CommonTest.test_constructor_exception_handling

I skimmed over the whole file and only saw those three. Of course I could have easily missed more.

I think someone should update those three tests so they test objects created using self.type2test, and make a more thorough pass over the file making sure there aren't any other missing type2test casts.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    testsTests in the Lib/test dir
    on Sep 6, 2025
  2. added a commit that references this issue on Sep 6, 2025
  3. added a commit that references this issue on Sep 7, 2025
  4. added 2 commits that reference this issue on Sep 7, 2025
  5. reopened this on Sep 7, 2025
  6. picnixz commented on Sep 7, 2025

    @picnixz
    Member

    Keeping it open until backports land.

  7. added a commit that references this issue on Sep 7, 2025
  8. added a commit that references this issue on Sep 7, 2025
  9. added a commit that references this issue on Sep 9, 2025
  10. added a commit that references this issue on Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    easytestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions