-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check_type([1, "hi"], list[int])
doesn't raise error
#439
Comments
check_type([1, "2"], list[int])
doesn't raise errorcheck_type([1, "hi"], list[int])
doesn't raise error
See #418 (comment). |
Thanks for the quick response @davidbrochart . You are legend and that is exactly what I was experiencing. However I tried the following which still didn't got an error for some reason? import typeguard
from typeguard import check_type, CollectionCheckStrategy
typeguard.config.collection_check_strategy = CollectionCheckStrategy.ALL_ITEMS
check_type(value=[1, "hi"], expected_type=list[int]) Do you have any advice? Thanks! |
Seems like a bug. |
No, it's not. This default was adopted because Beartype adopted it, but given how many complaints I've received because of it, typically from users who post bug reports without reading the documentation first, I'm seriously considering reverting this behavior in the next major release. |
Apologies, I have been one of them 😭 . Yes could confirm this works as expected. from typeguard import check_type, CollectionCheckStrategy
check_type(
value=[1, "hi"], expected_type=list[int, int],
collection_check_strategy=CollectionCheckStrategy.ALL_ITEMS
) |
Things to check first
I have searched the existing issues and didn't find my bug already reported there
I have checked that my bug is still present in the latest release
Typeguard version
4.1.5
Python version
3.11.7
What happened?
First time
typeguard
user and hope I'm not asking a silly question here. But the following code doesn't seem to trigger an error for some reason:Maybe I missed something? Thanks.
How can we reproduce the bug?
The text was updated successfully, but these errors were encountered: