Skip to content

Add tests for singledispatch #10627

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 2 commits into from
Jun 16, 2021
Merged

Conversation

pranavrajpal
Copy link
Contributor

This adds mypy tests for singledispatch, most of which are either based on the use of singledispatch in stubtest.py or seem like they would be common errors. All of these tests are currently skipped because mypy unsurprisingly doesn't catch these errors yet due to the lack of singledispatch support.

I ended up adding some new error messages for some tests, but I'm not intending for those to be the final error messages that we actually end up using. I just wanted to put something for those errors as a stand-in that we can replace later if anyone has any other preferences.

Add mypy tests for singledispatch that represent common errors that we
probably want to handle correctly. All of these tests are skipped
currently because mypy doesn't properly support singledispatch type
checking.
Copy link
Collaborator

@msullivan msullivan left a comment

Choose a reason for hiding this comment

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

This looks pretty good; switch it to the new xfail and then we can do it

Change the mypy tests to xfails so we realize sooner if they start
passing.
@sobolevn
Copy link
Member

Related: I am working on singledispatch on steroids: https://github.com/dry-python/classes/

It supports even generic functions with type restrictions.
Examples: https://github.com/dry-python/classes/tree/master/typesafety/test_typeclass

It might be useful while working on singledispatch support.

@msullivan msullivan merged commit d3c30fe into python:master Jun 16, 2021
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.

3 participants