You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discovered by chance while adding test coverage related to ordinals for decimal numbers (if I'd represented the decimal by using a string, then I wouldn't have found this).
The text was updated successfully, but these errors were encountered:
pydantic's validation appears to read the num: Union[int, Word] argument from the method signature and uses it to coerce the resulting num variable to type int.
If that's the case, then the ordinal method likely does not handle many float inputs correctly.
A possible fix could involve adjusting the method's signature, and/or adjusting the type hints:
On further consideration, I don't believe I truly understood the implications of #179, and while adopting Pydantic 2, I'm having to revisit this issue, because Pydantic is now (correctly) failing when an int or float is passed but the type annotation indicates Word.
Expected behaviour:
Actual behaviour:
Possible cause:
float
.Discovered by chance while adding test coverage related to ordinals for decimal numbers (if I'd represented the decimal by using a string, then I wouldn't have found this).
The text was updated successfully, but these errors were encountered: