diff --git a/conformance/results/mypy/enums_behaviors.toml b/conformance/results/mypy/enums_behaviors.toml index 80498e65..a3193b61 100644 --- a/conformance/results/mypy/enums_behaviors.toml +++ b/conformance/results/mypy/enums_behaviors.toml @@ -2,6 +2,8 @@ conformant = "Pass" errors_diff = """ """ output = """ -enums_behaviors.py:39: error: Cannot extend enum with existing members: "Shape" [misc] +enums_behaviors.py:28: error: Expression is of type "Color", not "Literal[Color.RED]" [assert-type] +enums_behaviors.py:32: error: Expression is of type "Color", not "Literal[Color.BLUE]" [assert-type] +enums_behaviors.py:44: error: Cannot extend enum with existing members: "Shape" [misc] """ conformance_automated = "Pass" diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml index a9b73efe..3c192fd9 100644 --- a/conformance/results/mypy/version.toml +++ b/conformance/results/mypy/version.toml @@ -1,2 +1,2 @@ version = "mypy 1.17.0" -test_duration = 2.7 +test_duration = 1.9 diff --git a/conformance/results/pyre/enums_behaviors.toml b/conformance/results/pyre/enums_behaviors.toml index 49c045e2..d1c240fc 100644 --- a/conformance/results/pyre/enums_behaviors.toml +++ b/conformance/results/pyre/enums_behaviors.toml @@ -5,5 +5,7 @@ conformance_automated = "Pass" errors_diff = """ """ output = """ -enums_behaviors.py:39:0 Invalid inheritance [39]: Cannot inherit from final enum `Shape`. Enums with defined members cannot be extended. +enums_behaviors.py:28:0 Assert type [70]: Expected `typing_extensions.Literal[Color.RED]` but got `Color`. +enums_behaviors.py:32:0 Assert type [70]: Expected `typing_extensions.Literal[Color.BLUE]` but got `Color`. +enums_behaviors.py:44:0 Invalid inheritance [39]: Cannot inherit from final enum `Shape`. Enums with defined members cannot be extended. """ diff --git a/conformance/results/pyre/qualifiers_final_decorator.toml b/conformance/results/pyre/qualifiers_final_decorator.toml index ef5be734..09c5e28b 100644 --- a/conformance/results/pyre/qualifiers_final_decorator.toml +++ b/conformance/results/pyre/qualifiers_final_decorator.toml @@ -18,7 +18,7 @@ qualifiers_final_decorator.py:126:0 Invalid inheritance [39]: `final` cannot be """ conformance_automated = "Fail" errors_diff = """ -Lines 80, 89: Expected error (tag 'Derived3') -Lines 94, 102: Expected error (tag 'Derived4') +Lines 80, 81, 89: Expected error (tag 'Derived3') +Lines 94, 95, 102: Expected error (tag 'Derived4') Line 51: Unexpected errors ['qualifiers_final_decorator.py:51:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] """ diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index 02af2cfe..de515ba2 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.25" -test_duration = 3.9 +test_duration = 7.4 diff --git a/conformance/results/pyright/enums_behaviors.toml b/conformance/results/pyright/enums_behaviors.toml index 8a9ff77e..3d5c93da 100644 --- a/conformance/results/pyright/enums_behaviors.toml +++ b/conformance/results/pyright/enums_behaviors.toml @@ -2,6 +2,8 @@ conformant = "Pass" errors_diff = """ """ output = """ -enums_behaviors.py:39:21 - error: Enum class "Shape" is final and cannot be subclassed (reportGeneralTypeIssues) +enums_behaviors.py:28:13 - error: "assert_type" mismatch: expected "Literal[Color.RED]" but received "Color" (reportAssertTypeFailure) +enums_behaviors.py:32:13 - error: "assert_type" mismatch: expected "Literal[Color.BLUE]" but received "Color" (reportAssertTypeFailure) +enums_behaviors.py:44:21 - error: Enum class "Shape" is final and cannot be subclassed (reportGeneralTypeIssues) """ conformance_automated = "Pass" diff --git a/conformance/results/pyright/version.toml b/conformance/results/pyright/version.toml index a5b181d8..79f18fab 100644 --- a/conformance/results/pyright/version.toml +++ b/conformance/results/pyright/version.toml @@ -1,2 +1,2 @@ version = "pyright 1.1.403" -test_duration = 5.6 +test_duration = 1.4 diff --git a/conformance/results/results.html b/conformance/results/results.html index 7b4f244c..aab60e77 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -159,13 +159,13 @@

Python Type System Conformance Test Results

 
mypy 1.17.0
-
2.7sec
+
1.9sec
pyright 1.1.403
-
5.6sec
+
1.4sec
pyre 0.9.25
-
3.9sec
+
7.4sec
diff --git a/conformance/tests/enums_behaviors.py b/conformance/tests/enums_behaviors.py index fa3aeec7..eeb74ddf 100644 --- a/conformance/tests/enums_behaviors.py +++ b/conformance/tests/enums_behaviors.py @@ -5,7 +5,7 @@ # Specification: https://typing.readthedocs.io/en/latest/spec/enums.html#enum-definition from enum import Enum -from typing import assert_type +from typing import assert_type, Literal # > Enum classes are iterable and indexable, and they can be called with a # > value to look up the enum member with that value. Type checkers should @@ -23,8 +23,13 @@ class Color(Enum): # > constructor. Instead, the call performs a value-based lookup of an # > enum member. -assert_type(Color["RED"], Color) # 'Literal[Color.RED]' is also acceptable -assert_type(Color(3), Color) # 'Literal[Color.BLUE]' is also acceptable +# 'Literal[Color.RED]' and 'Color' are both acceptable +assert_type(Color["RED"], Color) # E[red] +assert_type(Color["RED"], Literal[Color.RED]) # E[red] + +# 'Literal[Color.BLUE]' and 'Color' are both acceptable +assert_type(Color(3), Color) # E[blue] +assert_type(Color(3), Literal[Color.BLUE]) # E[blue] # > An Enum class with one or more defined members cannot be subclassed. diff --git a/conformance/tests/qualifiers_final_decorator.py b/conformance/tests/qualifiers_final_decorator.py index 3523ae53..5f131f46 100644 --- a/conformance/tests/qualifiers_final_decorator.py +++ b/conformance/tests/qualifiers_final_decorator.py @@ -65,7 +65,7 @@ def method3() -> None: # E[method3] pass @overload # E[method4] - def method4(self, x: int) -> int: + def method4(self, x: int) -> int: # E[method4] ... @overload @@ -78,7 +78,7 @@ def method4(self, x: int | str) -> int | str: # E[method4] class Derived3(Base3): @overload # E[Derived3] - def method(self, x: int) -> int: + def method(self, x: int) -> int: # E[Derived3] ... @overload # E[Derived3-2] @@ -92,7 +92,7 @@ def method(self, x: int | str) -> int | str: # E[Derived3] class Derived4(Base4): @overload # E[Derived4] - def method(self, x: int) -> int: + def method(self, x: int) -> int: # E[Derived4] ... @overload