MCPcopy
hub / github.com/pydantic/pydantic / MyModel

Class MyModel

tests/test_validators.py:874–880  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

872
873def test_validate_all():
874 class MyModel(BaseModel):
875 x: int
876
877 @field_validator('*')
878 @classmethod
879 def validate_all(cls, v: Any):
880 return v * 2
881
882 assert MyModel(x=10).x == 20
883

Calls 4

AfterValidatorClass · 0.90
BeforeValidatorClass · 0.90
PlainValidatorClass · 0.90
WrapValidatorClass · 0.90