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

Handle types from types module #292

Merged
merged 2 commits into from Jan 15, 2023
Merged

Handle types from types module #292

merged 2 commits into from Jan 15, 2023

Conversation

hoodmane
Copy link
Collaborator

@hoodmane hoodmane commented Jan 15, 2023

The types module has a bunch of things like ModuleType: ModuleType.__module__ is
"builtins" and ModuleType.__name__ is "module", but it should be referenced as types.ModuleType.

To deal with these, I made a dict of values exported from types to the export name. If an annotation
is in this dict, we use "types" as the module and the reported name as the name.

I also made a couple of nonfunctional changes:

  1. I think _is_newtype is more readable as a separate method so I factored it out.
  2. test_parse_annotation displays more useful error messages if we assert two tuples are equal than if we make three sequential assertions -- this way we can see if more than one are wrong.

@gaborbernat gaborbernat merged commit bf68ffc into tox-dev:main Jan 15, 2023
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.

None yet

2 participants