()
| 62 | |
| 63 | |
| 64 | def test_annotated_validator_before() -> None: |
| 65 | FloatMaybeInf = Annotated[float, BeforeValidator(lambda x, _info: x if x != 'zero' else 0.0)] |
| 66 | |
| 67 | class Model(BaseModel): |
| 68 | x: FloatMaybeInf |
| 69 | |
| 70 | assert Model(x='zero').x == 0.0 |
| 71 | assert Model(x=1.0).x == 1.0 |
| 72 | assert Model(x='1.0').x == 1.0 |
| 73 | |
| 74 | |
| 75 | def test_annotated_validator_builtin() -> None: |
nothing calls this directly
no test coverage detected