agronholm / typeguard

Run-time type checker for Python
Other
1.5k stars 112 forks source link

Only checks the first value instead of the complete list #446

Closed cdgaete closed 5 months ago

cdgaete commented 5 months ago

Things to check first

Typeguard version

typeguard-4.2.1

Python version

Python 3.11.8 (main, Feb 26 2024, 21:39:34) [GCC 11.2.0] on linux

What happened?

I am expeting the TypeCheckError: item 1 of list is not an instance of str

How can we reproduce the bug?

from typeguard import check_type
from typing import List
string_list = ['nobody', 1, 1, 1, 1]
check_type(string_list, List[str])
agronholm commented 5 months ago

Duplicate of #430, #418 and #417.