ModelFactory.coverage()
fails on models that have validation_alias
set
import typing
import pydantic
from polyfactory.factories.pydantic_factory import ModelFactory
class C(pydantic.BaseModel):
a: typing.Annotated[str, pydantic.Field(validation_alias="b")]
class CFactory(ModelFactory[C]):
pass
for _ in CFactory.coverage():
pass
pydantic_core._pydantic_core.ValidationError: 1 validation error for C
b
Field required [type=missing, input_value={'a': 'FdhLXuyqOfQSYmiqClUe'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.7/v/missing
2.16.2
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too