You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lib/tests/list_tests.py is missing type2test in a few methods #138584
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.
Activity
pythongh-138584: Add NEWS entry for missing type2test in list_tests
gh-138584: Increase test coverage for `collections.UserList` (#138590)
pythongh-138584: Increase test coverage for `collections.UserList` (p…
pythongh-138584: Increase test coverage for `collections.UserList` (p…
picnixz commentedon Sep 7, 2025
Keeping it open until backports land.
[3.13] gh-138584: Increase test coverage for `collections.UserList` (G…
[3.14] gh-138584: Increase test coverage for `collections.UserList` (G…
[3.14] pythongh-138584: Increase test coverage for `collections.UserL…
pythongh-138584: Increase test coverage for `collections.UserList` (p…