-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
feat: autofill model
argument when calling create_factory
with receiving factory __model__
#429
Conversation
Sets the model argument optional when creating a factory using imperative style and defaults to current factory model
model
argument when calling create_factory
with receiving factory __model__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This is based on the library author suggestion Co-authored-by: guacs <126393040+guacs@users.noreply.github.com>
I made the change as suggested but pyright is not happy. It was the reason why I've made it the previous way. Do you want me to simply turn off the pyright warning for that line or have any suggestion? |
Aah gotcha. I think a pyright ignore is good for that line since I think it's better to have the |
Fine, I've made the change 🤓 |
Documentation preview will be available shortly at https://litestar-org.github.io/polyfactory-docs-preview/429 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@g0di sorry for the delay! Thank you very much for the contribution :)
@all-contributors add @g0di for code, docs, test |
I've put up a pull request to add @g0di! 🎉 |
Pull Request Checklist
Description
This PR aims at allowing to create "sub" factories from concrete factories (i.e: a factory with a
__model__
set) without having to pass themodel
argument to thecreate_factory
method.In this case, when the
model
argument is omitted, the__model__
of the receiving factory will be used by default, increasing code readability and making the dynamic mode working the same way as the imperative style.Close Issue(s)
Closes #357