← Back to index
directives_type_checking.py
TP: 0
FP: 0
FN: 0
Optional: 0 / 0
2Tests the typing.TYPE_CHECKING constant.
5# Specification: https://typing.readthedocs.io/en/latest/spec/directives.html#type-checking
7from typing import TYPE_CHECKING, assert_type
11 a: int = "" # This should not generate an error
14 b: list[int] = [1, 2, 3]
16 b: list[str] = ["a", "b", "c"]
18assert_type(b, list[int])