fields#
- class polyfactory.fields.WrappedCallable#
Bases:
TypedDict
A ref storing a callable. This class is a utility meant to prevent binding of methods.
- class polyfactory.fields.Require#
Bases:
object
A factory field that marks an attribute as a required build-time kwarg.
- class polyfactory.fields.Use#
Bases:
Generic
[P
,T
]Factory field used to wrap a callable.
The callable will be invoked whenever building the given factory attribute.
- __init__(fn: ~typing.Callable[[~P], ~polyfactory.fields.T], *args: ~typing.~P, **kwargs: ~typing.~P) None #
Wrap a callable.
- Parameters:
fn – A callable to wrap.
args – Any args to pass to the callable.
kwargs – Any kwargs to pass to the callable.
- to_value() T #
Invoke the callable.
- Returns:
The output of the callable.
- class polyfactory.fields.PostGenerated#
Bases:
object
Factory field that allows generating values after other fields are generated by the factory.
- class polyfactory.fields.Fixture#
Bases:
object
Factory field to create a pytest fixture from a factory.