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
The verify_all function currently hints the parameters a_list as List[str] and formatter as Optional[Callable]. Perhaps better type hints would be (using 3.12 syntax but this could be done with the old-style generic type syntax):
This would allow for any object to be passed in as the expected result with the formatter transforming the object into a string for approval — without type checkers complaining.
In fact, the default formatter for this function already calls str by default on objects from alist (see list_utils.py) when transforming the list to a string.
The text was updated successfully, but these errors were encountered:
James-Ansley
changed the title
Generic type hints for verify_all's alist and formatter paramters
Generic type hints for verify_all's alist and formatter parameters
Oct 2, 2024
The
verify_all
function currently hints the parametersa_list
asList[str]
andformatter
asOptional[Callable]
. Perhaps better type hints would be (using 3.12 syntax but this could be done with the old-style generic type syntax):This would allow for any object to be passed in as the expected result with the formatter transforming the object into a string for approval — without type checkers complaining.
In fact, the default formatter for this function already calls
str
by default on objects fromalist
(see list_utils.py) when transforming the list to a string.The text was updated successfully, but these errors were encountered: