-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-138584: Fix missing type2test in Lib/tests/list_tests.py #138590
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
Conversation
Misc/NEWS.d/next/Tests/2025-09-06-21-50-00.gh-issue-138584.XyZ9Ab.rst
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked the usage of this class but I think we can just assume that we'll only be using it for list and userlist so it's fine to keep the error message as is. If it needs to be changed later, we'll just refactor the tests nicely.
…ythonGH-138590) Some common tests in `test.list_tests.CommonTest` explicitly tested `list` instead of testing the underlying list-like type defined in `type2test`. --------- (cherry picked from commit d7b9ea5) Co-authored-by: dbXD320 <[email protected]> Co-authored-by: Devansh Baghla <[email protected]>
…ythonGH-138590) Some common tests in `test.list_tests.CommonTest` explicitly tested `list` instead of testing the underlying list-like type defined in `type2test`. --------- (cherry picked from commit d7b9ea5) Co-authored-by: dbXD320 <[email protected]> Co-authored-by: Devansh Baghla <[email protected]>
GH-138611 is a backport of this pull request to the 3.13 branch. |
GH-138612 is a backport of this pull request to the 3.14 branch. |
For the sake of reducing the diff and correctly improve test coverage, I'm going to backport this. |
@serhiy-storchaka @picnixz Thank you for the review and guidance, I really appreciate it! |
Thank you for the fix |
…H-138590) (#138611) gh-138584: Increase test coverage for `collections.UserList` (GH-138590) Some common tests in `test.list_tests.CommonTest` explicitly tested `list` instead of testing the underlying list-like type defined in `type2test`. --------- (cherry picked from commit d7b9ea5) Co-authored-by: dbXD320 <[email protected]> Co-authored-by: Devansh Baghla <[email protected]>
…H-138590) (#138612) Co-authored-by: dbXD320 <[email protected]> Co-authored-by: Devansh Baghla <[email protected]>
…ist` (pythonGH-138590) (python#138612) Co-authored-by: dbXD320 <[email protected]> Co-authored-by: Devansh Baghla <[email protected]>
…ython#138590) Some common tests in `test.list_tests.CommonTest` explicitly tested `list` instead of testing the underlying list-like type defined in `type2test`. --------- Co-authored-by: Devansh Baghla <[email protected]>
This PR updates three tests in Lib/test/list_tests.py (CommonTest) to consistently use self.type2test instead of directly constructing a list (or []).
test_getitem_error
test_setitem_error
test_constructor_exception_handling
Previously, these tests only applied to the builtin list, and skipped other list-like classes (such as collections.UserList) that reuse CommonTest.
By switching to self.type2test, the tests now correctly apply to all list-like types under test, ensuring consistency across the test suite.
fixes #138584