diff --git a/conformance/results/results.html b/conformance/results/results.html index 249f6b70..25453296 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -1176,7 +1176,7 @@

Python Type System Conformance Test Results

Pass Pass Pass -
Partial

Attempts to detect some errors even in blocks it determines to be unreachable, including in `if not TYPE_CHECKING` blocks.

+Pass      directives_type_ignore
Partial

Does not honor "# type: ignore" comment if comment includes additional text.

diff --git a/conformance/results/ty/directives_type_checking.toml b/conformance/results/ty/directives_type_checking.toml index a9ad6809..cdd4d0cd 100644 --- a/conformance/results/ty/directives_type_checking.toml +++ b/conformance/results/ty/directives_type_checking.toml @@ -1,11 +1,5 @@ -conformance_automated = "Fail" -conformant = "Partial" -notes = """ -Attempts to detect some errors even in blocks it determines to be unreachable, including in `if not TYPE_CHECKING` blocks. -""" +conformance_automated = "Pass" errors_diff = """ -Line 11: Unexpected errors ['directives_type_checking.py:11:14: error[invalid-assignment] Object of type `Literal[""]` is not assignable to `int`'] """ output = """ -directives_type_checking.py:11:14: error[invalid-assignment] Object of type `Literal[""]` is not assignable to `int` """ diff --git a/conformance/tests/directives_type_checking.py b/conformance/tests/directives_type_checking.py index 55a2d52d..f491560e 100644 --- a/conformance/tests/directives_type_checking.py +++ b/conformance/tests/directives_type_checking.py @@ -7,12 +7,12 @@ from typing import TYPE_CHECKING, assert_type -if not TYPE_CHECKING: - a: int = "" # This should not generate an error +def foo(x: list[int], y: list[str]) -> None: + z: list[int] | list[str] -if TYPE_CHECKING: - b: list[int] = [1, 2, 3] -else: - b: list[str] = ["a", "b", "c"] + if TYPE_CHECKING: + z = x + else: + z = y -assert_type(b, list[int]) + assert_type(z, list[int])