assert_type
does not handle 'Type[]' of Protocol types correctly
#15701
Labels
assert_type
does not handle 'Type[]' of Protocol types correctly
#15701
Bug Report
According to PEP 544, "Variables and parameters annotated with
Type[Proto]
accept only concrete (non-protocol) subtypes of Proto." (https://peps.python.org/pep-0544/#type-and-class-objects-vs-protocols)Using
assert_type
to check ifProto
is accepted asType[Proto]
fails to report an error.(from #15666)
To Reproduce
Expected Behavior
assert_type
should confirm thatProto
does not have an inferred type ofType[Proto]
.Actual Behavior
assert_type
acceptsProto
to have an inferred type ofType[Proto]
.Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: