-
-
Notifications
You must be signed in to change notification settings - Fork 451
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
Support returning the correct values for the different QuerySet methods when using .values() and .values_list(). #33
Support returning the correct values for the different QuerySet methods when using .values() and .values_list(). #33
Conversation
…ds when using .values() and .values_list().
…ored errors that are no longer needed.
9bde821
to
8892414
Compare
It's not clear to me, how all of that works. Could you add tests for other methods of
|
I have added a lot more tests, and in the process, caught that I had missed updating the .iterator method. I haven't tested all of the queryset methods that I changed at the moment, as it's quite tedious to create all the cases. If I get some more time, I will add some more. The annoying thing is that you cannot tell mypy that the default type for _Row is _T. It would make it a lot more user-friendly for annotating your own code. |
Sorry, I was wrong/imprecise in my comment, testing all the methods is indeed very tedious and pretty redundant. It should be enough to select just one of the group with the same number of generics present in the signature and same return type, like one of
one of
and so on. And thank you very much for your efforts! |
We can hide it from users by leveragive
Please, address TODOs, see also python/mypy#6503. Error messages should also be changed, but let's do it some time later, as it should also be done for all |
That sounds like a good plan by using |
- Use correct return type for QuerySet.dates() / QuerySet.datetimes(). - Use correct type params in return type for QuerySet.__and__ / QuerySet.__or__ - Re-add Sized as base class for QuerySet. - Add test of .all() for all _Row types. - Add test of .get() for all _Row types. - Remove some redundant QuerySet method tests.
... if second parameter is omitted.
342bcae
to
5f71ccb
Compare
I think it's ready for your review again now :) I made a few more changes to fix some small issues I noticed as well:
|
PR looks great, resolve conflicts with master again and I'll merge. |
No description provided.