-
-
Notifications
You must be signed in to change notification settings - Fork 485
Type of model is not model's class #40
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
Comments
Technically, I tried to reproduce, but had no luck. Could you provide failing test case in the form of
You can look at the plugin test suite for the format and examples |
Thanks, I will try to reproduce. |
Couldn't reproduce. The test case I wrote didn't throw the error. I probably have a Django model stub in a Sorry for the false alarm and keep up the good work! |
First of all, django-stubs is an amazing project. I built some workarounds for typing Django myself but this project is so much more comprehensive and better. So thank you very much for your work!
However, I have run into my first issue:
For the following code
mypy complains with the following error message:
Expecting
Union[Type[Model], str]
is completely correct imho. But sinceComment
is a subclass ofModel
everything should be fine.In order to find the underlying problem I inserted an
reveal_type(Comment)
call which gave me the following output:Maybe this is totally fine and due to the internals of the plugin. But I expected it to be
Type[Comment]
which could also be the reason why mypy doesn't recognize it as compatible toType[Model]
.(What I don't understand is why mypy says
Type[Comment]
in the first error message which contradicts the 'revealed type' output)The text was updated successfully, but these errors were encountered: