mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
1b467da11f
* Added generic approach to strict type checking for constraint types - Use the arbitrary validator to build strict validators for ConstrainedInt, ConstrainedFloat, ConstrainedStr - Make StrictStr a derived class of ConstrainedStr - Add tests for new strict cases for ConstrainedInt and ConstrainedFloat * - Created StrictInt and StrictFloat subclasses and exported them - Changed strictness tests to use these new subclasses * - Added section for Strict Types to docs * - Added changes file * Update docs/index.rst Co-Authored-By: Zaar Hai <haizaar@users.noreply.github.com> * Update docs/index.rst Co-Authored-By: Zaar Hai <haizaar@users.noreply.github.com> * - Create validators for strict int and float - Make ConstrainedInt and ConstrainedFloat use those validators instead of abusing arbitrary type validator for strictness - Prevent double validaton of same conditions by only yielding either the strict or non-strict type validator for for those classes * Changed strict int and float tests to alos match for exception message in invalid cases * - Removed obvious note about lack of ConstrainedBool - Added example for strict type usage - Added note about caveats for StrictInt and StrictFloat * Update pydantic/validators.py faster method to check if a value is boolean for strict int validator Co-Authored-By: Samuel Colvin <samcolvin@gmail.com> * - Removed StrictBool part from Boolean section of docs - Moved the Strctbool code example into strict_types.py example file * - Changed behavior of strictness for COnstrainedStr to match that fo other constrained types * - Actually make ConstrainedStr use the correct validator for strictness