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 use of TypeVar on generic subclasses #842
Conversation
1da795d
to
4031b90
Compare
Codecov Report
@@ Coverage Diff @@
## master #842 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 17 17
Lines 3024 3024
Branches 582 582
=====================================
Hits 3024 3024 Continue to review full report at Codecov.
|
@zpencerq Yes, I noticed recently that this also prevents you from using bounds to restrict the TypeVars in subclasses. Thanks for contributing this. You should be able to fix the formatting issues currently causing tests to fail by running You can also run a plain (More detail here: https://pydantic-docs.helpmanual.io/#contributing-to-pydantic) |
Should I open this against (or change base to) |
@zpencerq I think just against master is fine — I think @samuelcolvin is hoping to release a beta this week. |
thanks so much. |
* Add failing generic subclass test * Only raise type parameter failure on base GenericModel class * Add changes to describe PR pydantic#842 * Change the class check to use is * Fix formatting in subclass test * correct change
This change was originally introduced to support generic functions on generic types defined for
pydantic
.Notably, passing a
TypeVar
on aGenericModel
subclass raises aTypeError
(presumably?) meant for assisting users in defining their generic model classes.Example:
Change Summary
TypeVar
onGenericModel
subclasses.Checklist
changes/<pull request or issue id>-<github username>.rst
file added describing change(see changes/README.md for details)