Skip to content
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

annotate unittest.TestCase.__init_subclass__ #13602

Merged
merged 1 commit into from
Mar 9, 2025

Conversation

jorenham
Copy link
Contributor

@jorenham jorenham commented Mar 8, 2025

NumPy re-exports unittest.TestCase in several modules, which caused stubtest to complain about incorrect __init_subclass__ signature (see e.g. numpy/numtype@d6af1ad).

I noticed that in the relevant typeshed allowlists there was a comment that said

Runtime has *args, **kwargs, but will error if any are supplied

So I figured that Never could also fulfill be used to fulfill that role. That way we can have the cake and eat it too.

Thoughts?

Copy link
Contributor

github-actions bot commented Mar 8, 2025

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a clever fix. I actually like this version better than just leaving out the args.

@srittau srittau merged commit ab46a26 into python:main Mar 9, 2025
55 checks passed
@jorenham jorenham deleted the unittest.TestCase.__init_subclass__ branch March 9, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants