-
-
Notifications
You must be signed in to change notification settings - Fork 105
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Using MyFactory.build() works fine, but when using MyFactory.coverage() then the annotated pydantic.Field constraint is ignored.
MCVE
from typing import Annotated
from decimal import Decimal
import pydantic
from polyfactory.factories.pydantic_factory import ModelFactory
class Model(pydantic.BaseModel):
d: Annotated[Decimal, pydantic.Field(max_digits=18, decimal_places=4)] | None
class MyFactory(ModelFactory[Model]):
__check_model__ = True
list(MyFactory.coverage())Logs
pydantic_core._pydantic_core.ValidationError: 1 validation error for Model
Decimal input should have no more than 18 digits in total [type=decimal_max_digits, input_value=Decimal('-6874602807633095298158368109.83'), input_type=Decimal]
For further information visit https://errors.pydantic.dev/2.12/v/decimal_max_digitsRelease Version
polyfactory==2.22.3
pydantic==2.12.3
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working