Skip to content

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

@larryhastings

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

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