msgspec_factory¶
- class polyfactory.factories.msgspec_factory.MsgspecFactory[source]¶
Bases:
Generic
[T
],BaseFactory
[T
]Base factory for msgspec Structs.
- __is_base_factory__: bool = True¶
Flag dictating whether the factory is a ‘base’ factory. Base factories are registered globally as handlers for types. For example, the ‘DataclassFactory’, ‘TypedDictFactory’ and ‘ModelFactory’ are all base factories.
- classmethod get_provider_map() dict[Any, Callable[[], Any]] [source]¶
Map types to callables which accept no arguments and return a random value of the given type.
- Notes:
This method is distinct to allow overriding.
- Returns:
a dictionary mapping types to callables.