ruff
71e87c8f - [ty] Accept documented boolean and fractional Pydantic inputs (#27754)

Commit
30 days ago
[ty] Accept documented boolean and fractional Pydantic inputs (#27754) ## Summary Previously, we rejected byte strings for Pydantic boolean fields and `Fraction` instances for integer and floating-point fields, even though Pydantic explicitly documents these conversions: ```python from fractions import Fraction from pydantic import BaseModel class Model(BaseModel): enabled: bool count: int ratio: float Model(enabled=b"true", count=Fraction(2, 1), ratio=Fraction(1, 2)) ``` We now include `bytes` in `LaxBool` and `Fraction` in `LaxInt` and `LaxFloat`. These inputs are explicitly described in Pydantic's [boolean](https://pydantic.dev/docs/validation/latest/api/pydantic/standard_library_types/#booleans), [integer](https://pydantic.dev/docs/validation/latest/api/pydantic/standard_library_types/#integers), and [float](https://pydantic.dev/docs/validation/latest/api/pydantic/standard_library_types/#floats) documentation, even though they are missing from its published [conversion table](https://pydantic.dev/docs/validation/latest/concepts/conversion_table/).
Author
Parents
Loading