Skip to content

[3.13] gh-137463: Update validate_abstract_methods in test_collections.py (GH-137464) #137521

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

Merged
merged 1 commit into from
Aug 7, 2025

Conversation

guilhermeleobas
Copy link
Contributor

The test for missing abstract methods in validate_abstract_methods incorrectly attempted to instantiate the generated class C with an argument (C(name)), which always raises a TypeError: C() takes no arguments. Although the test originally passes, it passes for the wrong reason.

This change makes the test correctly validate the enforcement of abstract methods in ABCs.


📚 Documentation preview 📚: https://cpython-previews--137516.org.readthedocs.build/

@sobolevn
Copy link
Member

sobolevn commented Aug 7, 2025

assertIsSubclass is new :(
Can you please relace it?

…ons.py` (python#137464)

Update `validate_abstract_methods` in `test_collections.py`

The test for missing abstract methods in `validate_abstract_methods` incorrectly attempted to instantiate the generated class `C` with an argument (`C(name)`), which always raises a `TypeError: C() takes no arguments`. Although the test originally passes, it passes for the wrong reason.

This change makes the test correctly validate the enforcement of abstract methods in ABCs.

(cherry picked from commit 5be8723)
@guilhermeleobas guilhermeleobas marked this pull request as ready for review August 7, 2025 17:05
@guilhermeleobas
Copy link
Contributor Author

assertIsSubclass is new :( Can you please relace it?

Done!

@sobolevn sobolevn merged commit 16cebe6 into python:3.13 Aug 7, 2025
38 checks passed
@guilhermeleobas guilhermeleobas deleted the backport-5be8723-3.13 branch August 7, 2025 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants