fields¶
- class polyfactory.fields.WrappedCallable[source]¶
Bases:
TypedDict
A ref storing a callable. This class is a utility meant to prevent binding of methods.
- class polyfactory.fields.Require[source]¶
Bases:
object
A factory field that marks an attribute as a required build-time kwarg.
- class polyfactory.fields.NeverNone[source]¶
Bases:
object
A factory field that marks as always generated, even if it’s an optional.
- class polyfactory.fields.AlwaysNone[source]¶
Bases:
object
A factory field that marks as never generated, setting the value to None, regardless of if it’s an optional field
This is distinct from Ignore() which does not set a value for a field at all. If Ignore() is used and a default value for a field is not set on the underlying model, then the field will not be set at all.
- class polyfactory.fields.Ignore[source]¶
Bases:
object
A factory field that marks an attribute as ignored. This prevents the factory generating any value for this field.
If you are using this on a pydantic model this will cause the field to be omitted from the resulting pydantic model if there is no default value set for the pydantic field.
- class polyfactory.fields.Use[source]¶
Bases:
Generic
[P
,T
]Factory field used to wrap a callable.
The callable will be invoked whenever building the given factory attribute.
- class polyfactory.fields.PostGenerated[source]¶
Bases:
object
Factory field that allows generating values after other fields are generated by the factory.