MCPcopy
hub / github.com/pydantic/pydantic / test_plain_validator_field_name

Function test_plain_validator_field_name

tests/test_validators.py:2805–2812  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2803
2804
2805def test_plain_validator_field_name():
2806 class MyModel(BaseModel):
2807 x: int
2808 foobar: Annotated[int, PlainValidator(foobar_validate)]
2809
2810 m = MyModel(x='123', foobar='1')
2811 # insert_assert(m.foobar)
2812 assert m.foobar == {'value': '1', 'field_name': 'foobar', 'data': {'x': 123}}
2813
2814
2815def test_validator_field_name_with_reused_type_alias():

Callers

nothing calls this directly

Calls 1

MyModelClass · 0.70

Tested by

no test coverage detected