From 892ca8f3c333a9510de5d8d67f8faf2f1f1fb5d8 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Sat, 19 Apr 2025 12:54:39 +0500 Subject: [PATCH 1/6] Baseline conformance output before typeddict changes --- conformance/results/pyright/version.toml | 4 ++-- conformance/results/pytype/protocols_merging.toml | 4 ++-- conformance/results/pytype/version.toml | 2 +- conformance/results/results.html | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/conformance/results/pyright/version.toml b/conformance/results/pyright/version.toml index 8fb908adb..3df68e70d 100644 --- a/conformance/results/pyright/version.toml +++ b/conformance/results/pyright/version.toml @@ -1,2 +1,2 @@ -version = "pyright 1.1.398" -test_duration = 2.3 +version = "pyright 1.1.399" +test_duration = 2.5 diff --git a/conformance/results/pytype/protocols_merging.toml b/conformance/results/pytype/protocols_merging.toml index a3102a965..28275fdd8 100644 --- a/conformance/results/pytype/protocols_merging.toml +++ b/conformance/results/pytype/protocols_merging.toml @@ -6,12 +6,12 @@ Does not report attempt to instantiate abstract class downgraded from protocol c output = """ protocols_merging.py:52:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for s6 does not match type of assignment [annotation-type-mismatch] -s6: SizedAndClosable1 = SCConcrete2() # E: doesn't implement close +s6: SizedAndClosable1 = SCConcrete2() # E: doesn't implement `__len__` \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m protocols_merging.py:53:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for s7 does not match type of assignment [annotation-type-mismatch] -s7: SizedAndClosable2 = SCConcrete2() # E: doesn't implement close +s7: SizedAndClosable2 = SCConcrete2() # E: doesn't implement `__len__` \u001b[1m\u001b[31m~~\u001b[39m\u001b[0m protocols_merging.py:54:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Type annotation for s8 does not match type of assignment [annotation-type-mismatch] diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index cdc0a953f..70cfb40b1 100644 --- a/conformance/results/pytype/version.toml +++ b/conformance/results/pytype/version.toml @@ -1,2 +1,2 @@ version = "pytype 2024.10.11" -test_duration = 43.3 +test_duration = 42.2 diff --git a/conformance/results/results.html b/conformance/results/results.html index d78bd9122..74bd91aaf 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -161,14 +161,14 @@

Python Type System Conformance Test Results

mypy 1.15.0
2.1sec
-
pyright 1.1.398
-
2.3sec
+
pyright 1.1.399
+
2.5sec
pyre 0.9.23
3.9sec
pytype 2024.10.11
-
43.3sec
+
42.2sec
@@ -445,10 +445,10 @@

Python Type System Conformance Test Results

Class type compatibility      classes_classvar -
Partial

Internal error if TypeVarTuple is used in ClassVar.

Does not reject use of ParamSpec in ClassVar.

Rejects ClassVar nested in Annotated.

Does not reject use of ClassVar in TypeAlias definition.

Does not infer type of ClassVar from assignment if no type is provided.

+
Partial

Internal error if TypeVarTuple is used in ClassVar.

Does not reject use of ParamSpec in ClassVar.

Rejects ClassVar nested in Annotated.

Does not reject use of ClassVar in TypeAlias definition.

Pass
Partial

Does not reject use of TypeVar in ClassVar.

Does not reject use of ParamSpec in ClassVar.

Does not reject use of ClassVar as a generic type argument.

Does not reject use of ClassVar in parameter type annotation.

Does not reject use of ClassVar in local variable annotation.

Does not reject use of ClassVar in instance variable annotation.

Does not reject use of ClassVar in return type annotation.

Does not reject use of ClassVar in type alias definition.

Does not infer type from initialization for bare ClassVar.

-
Partial

Does not reject use of TypeVar in ClassVar.

Does not reject use of ParamSpec in ClassVar.

Does not reject use of ClassVar as a generic type argument.

Rejects initialization of ClassVar if no type argument is provided.

Does not reject use of ClassVar in parameter type annotation.

Does not reject use of ClassVar in local variable annotation.

Does not reject use of ClassVar in instance variable annotation.

Does not reject use of ClassVar in return type annotation.

Does not reject use of ClassVar in type alias definition.

Does not reject assignment of ClassVar through instance of class.

+
Partial

Does not reject use of TypeVar in ClassVar.

Does not reject use of ParamSpec in ClassVar.

Does not reject use of ClassVar as a generic type argument.

Rejects initialization of ClassVar if no type argument is provided.

Does not infer ClassVar with no type argument and no assigned value as Any.

Does not reject use of ClassVar in parameter type annotation.

Does not reject use of ClassVar in local variable annotation.

Does not reject use of ClassVar in instance variable annotation.

Does not reject use of ClassVar in return type annotation.

Does not reject use of ClassVar in type alias definition.

Does not reject assignment of ClassVar through instance of class.

     classes_override
Partial

Does not handle case where parent class derives from Any.

From 7e462db28079dba483a7e7a88a644fcea1155827 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Sat, 19 Apr 2025 10:54:25 +0500 Subject: [PATCH 2/6] typeddicts - popitem is not allowed --- conformance/tests/typeddicts_operations.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conformance/tests/typeddicts_operations.py b/conformance/tests/typeddicts_operations.py index f334f9568..910d6a33a 100644 --- a/conformance/tests/typeddicts_operations.py +++ b/conformance/tests/typeddicts_operations.py @@ -45,6 +45,7 @@ def func1(variable_key: str): movie.clear() # E: clear not allowed +movie.popitem() # E: popitem not allowed del movie["name"] # E: del not allowed for required key @@ -60,5 +61,6 @@ class MovieOptional(TypedDict, total=False): assert_type(movie_optional.get("name"), str | None) movie_optional.clear() # E: clear not allowed +movie_optional.popitem() # E: popitem not allowed del movie_optional["name"] From 29d155a688567f88e9b0d8d28750a41e4128827d Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Sat, 19 Apr 2025 11:01:18 +0500 Subject: [PATCH 3/6] typeddicts - operations with variable keys --- conformance/tests/typeddicts_operations.py | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/conformance/tests/typeddicts_operations.py b/conformance/tests/typeddicts_operations.py index 910d6a33a..a49de4365 100644 --- a/conformance/tests/typeddicts_operations.py +++ b/conformance/tests/typeddicts_operations.py @@ -32,10 +32,21 @@ class Movie(TypedDict): movie = {"name": "", "year": 1900, "other": 2} # E: extra key -def func1(variable_key: str): +def func1(variable_key: str, existing_movie: Movie): # > A key that is not a literal should generally be rejected. movie: Movie = {variable_key: "", "year": 1900} # E: variable key + # Destructive operations. + existing_movie[variable_key] = 1982 # E: variable key + del existing_movie[variable_key] # E + + # Read-only operations. + reveal_type(existing_movie[variable_key]) # E + + # Exceptions. + reveal_type(variable_key in existing_movie) # `bool` + assert_type(existing_movie.get(variable_key), object | None) + # It's not clear from the spec what type this should be. movie.get("name") @@ -64,3 +75,19 @@ class MovieOptional(TypedDict, total=False): movie_optional.popitem() # E: popitem not allowed del movie_optional["name"] + + +def func2(variable_key: str, existing_optional_movie: MovieOptional): + # > A key that is not a literal should generally be rejected. + movie_optional: MovieOptional = {variable_key: "", "year": 1900} # E: variable key + + # Destructive operations. + existing_optional_movie[variable_key] = 1982 # E: variable key + del existing_optional_movie[variable_key] # E: variable key + + # Read-only operations. + reveal_type(existing_optional_movie[variable_key]) # E + + # Exceptions. + reveal_type(variable_key in existing_optional_movie) # `bool` + assert_type(existing_optional_movie.get(variable_key), object | None) From d46f0a57c2c540a7903f0e582b1546310d4642be Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Sat, 19 Apr 2025 11:13:21 +0500 Subject: [PATCH 4/6] typeddicts - reading not required keys --- conformance/tests/typeddicts_operations.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conformance/tests/typeddicts_operations.py b/conformance/tests/typeddicts_operations.py index a49de4365..81c7ece49 100644 --- a/conformance/tests/typeddicts_operations.py +++ b/conformance/tests/typeddicts_operations.py @@ -69,6 +69,9 @@ class MovieOptional(TypedDict, total=False): movie_optional: MovieOptional = {} +# > Type checkers may allow reading an item using d['x'] +# even if the key 'x' is not required. +movie_optional["name"] # E? assert_type(movie_optional.get("name"), str | None) movie_optional.clear() # E: clear not allowed From baf90aa0d960f963608b50e3757a06d76a6975a7 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Sat, 19 Apr 2025 12:05:51 +0500 Subject: [PATCH 5/6] typeddicts - test unspecified operations with extra keys --- conformance/tests/typeddicts_operations.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/conformance/tests/typeddicts_operations.py b/conformance/tests/typeddicts_operations.py index 81c7ece49..8461cfed3 100644 --- a/conformance/tests/typeddicts_operations.py +++ b/conformance/tests/typeddicts_operations.py @@ -54,6 +54,8 @@ def func1(variable_key: str, existing_movie: Movie): # It's not clear from the spec what type this should be. movie.get("other") # E? +# It's not clear from the spec whether it's allowed. +reveal_type("other" in movie) # E? movie.clear() # E: clear not allowed movie.popitem() # E: popitem not allowed @@ -74,6 +76,12 @@ class MovieOptional(TypedDict, total=False): movie_optional["name"] # E? assert_type(movie_optional.get("name"), str | None) +# It's not clear from the spec what type this should be. +reveal_type(movie_optional.get("other")) # E? + +# It's not clear from the spec whether it's allowed. +reveal_type("other" in movie_optional) # E? + movie_optional.clear() # E: clear not allowed movie_optional.popitem() # E: popitem not allowed From 459f25b01020ba093c8c31d45867e16cee6e766a Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Sat, 19 Apr 2025 13:10:22 +0500 Subject: [PATCH 6/6] Update conformance outputs after typeddicts changes --- .../results/mypy/typeddicts_operations.toml | 23 ++++- conformance/results/mypy/version.toml | 2 +- .../results/pyre/typeddicts_operations.toml | 23 ++++- conformance/results/pyre/version.toml | 2 +- .../pyright/typeddicts_operations.toml | 35 ++++++- conformance/results/pyright/version.toml | 2 +- .../results/pytype/typeddicts_operations.toml | 97 ++++++++++++++++++- conformance/results/pytype/version.toml | 2 +- conformance/results/results.html | 8 +- 9 files changed, 170 insertions(+), 24 deletions(-) diff --git a/conformance/results/mypy/typeddicts_operations.toml b/conformance/results/mypy/typeddicts_operations.toml index 64839b9d6..d9a022452 100644 --- a/conformance/results/mypy/typeddicts_operations.toml +++ b/conformance/results/mypy/typeddicts_operations.toml @@ -8,9 +8,26 @@ typeddicts_operations.py:28: error: Missing key "year" for TypedDict "Movie" [t typeddicts_operations.py:29: error: Incompatible types (expression has type "float", TypedDict item "year" has type "int") [typeddict-item] typeddicts_operations.py:32: error: Extra key "other" for TypedDict "Movie" [typeddict-unknown-key] typeddicts_operations.py:37: error: Expected TypedDict key to be string literal [misc] -typeddicts_operations.py:47: error: "Movie" has no attribute "clear" [attr-defined] -typeddicts_operations.py:49: error: Key "name" of TypedDict "Movie" cannot be deleted [misc] -typeddicts_operations.py:62: error: "MovieOptional" has no attribute "clear" [attr-defined] +typeddicts_operations.py:40: error: TypedDict key must be a string literal; expected one of ("name", "year") [literal-required] +typeddicts_operations.py:41: error: Expected TypedDict key to be string literal [misc] +typeddicts_operations.py:44: note: Revealed type is "Any" +typeddicts_operations.py:44: error: TypedDict key must be a string literal; expected one of ("name", "year") [literal-required] +typeddicts_operations.py:47: note: Revealed type is "builtins.bool" +typeddicts_operations.py:58: note: Revealed type is "builtins.bool" +typeddicts_operations.py:60: error: "Movie" has no attribute "clear" [attr-defined] +typeddicts_operations.py:61: error: "Movie" has no attribute "popitem" [attr-defined] +typeddicts_operations.py:63: error: Key "name" of TypedDict "Movie" cannot be deleted [misc] +typeddicts_operations.py:80: note: Revealed type is "builtins.object" +typeddicts_operations.py:83: note: Revealed type is "builtins.bool" +typeddicts_operations.py:86: note: Revealed type is "builtins.bool" +typeddicts_operations.py:88: error: "MovieOptional" has no attribute "clear" [attr-defined] +typeddicts_operations.py:89: error: "MovieOptional" has no attribute "popitem" [attr-defined] +typeddicts_operations.py:96: error: Expected TypedDict key to be string literal [misc] +typeddicts_operations.py:99: error: TypedDict key must be a string literal; expected one of ("name", "year") [literal-required] +typeddicts_operations.py:100: error: Expected TypedDict key to be string literal [misc] +typeddicts_operations.py:103: note: Revealed type is "Any" +typeddicts_operations.py:103: error: TypedDict key must be a string literal; expected one of ("name", "year") [literal-required] +typeddicts_operations.py:106: note: Revealed type is "builtins.bool" """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml index 6bd36c63e..95a6c1a99 100644 --- a/conformance/results/mypy/version.toml +++ b/conformance/results/mypy/version.toml @@ -1,2 +1,2 @@ version = "mypy 1.15.0" -test_duration = 2.1 +test_duration = 1.9 diff --git a/conformance/results/pyre/typeddicts_operations.toml b/conformance/results/pyre/typeddicts_operations.toml index e8b1cf658..1b72db141 100644 --- a/conformance/results/pyre/typeddicts_operations.toml +++ b/conformance/results/pyre/typeddicts_operations.toml @@ -10,9 +10,26 @@ typeddicts_operations.py:28:8 TypedDict initialization error [55]: Missing requi typeddicts_operations.py:29:8 TypedDict initialization error [55]: Expected type `int` for `Movie` field `year` but got `float`. typeddicts_operations.py:32:8 TypedDict initialization error [55]: TypedDict `Movie` has no field `other`. typeddicts_operations.py:37:4 Incompatible variable type [9]: movie is declared to have type `Movie` but is used as type `Dict[str, Union[int, str]]`. -typeddicts_operations.py:47:0 Undefined attribute [16]: `Movie` has no attribute `clear`. -typeddicts_operations.py:49:0 Invalid TypedDict operation [54]: Cannot delete required field `name` from TypedDict `Movie`. -typeddicts_operations.py:62:0 Undefined attribute [16]: `MovieOptional` has no attribute `clear`. +typeddicts_operations.py:40:19 TypedDict accessed with a non-literal [26]: TypedDict key must be a string literal. Expected one of ('name', 'year'). +typeddicts_operations.py:41:23 TypedDict accessed with a non-literal [26]: TypedDict key must be a string literal. Expected one of ('name', 'year'). +typeddicts_operations.py:44:4 Revealed type [-1]: Revealed type for `existing_movie[variable_key]` is `str`. +typeddicts_operations.py:44:31 TypedDict accessed with a non-literal [26]: TypedDict key must be a string literal. Expected one of ('name', 'year'). +typeddicts_operations.py:47:4 Revealed type [-1]: Revealed type for `variable_key in existing_movie` is `bool`. +typeddicts_operations.py:58:0 Revealed type [-1]: Revealed type for `"other" in movie` is `bool`. +typeddicts_operations.py:60:0 Undefined attribute [16]: `Movie` has no attribute `clear`. +typeddicts_operations.py:61:0 Undefined attribute [16]: `Movie` has no attribute `popitem`. +typeddicts_operations.py:63:0 Invalid TypedDict operation [54]: Cannot delete required field `name` from TypedDict `Movie`. +typeddicts_operations.py:80:0 Revealed type [-1]: Revealed type for `movie_optional.get("other")` is `typing.Optional[object]`. +typeddicts_operations.py:83:0 Revealed type [-1]: Revealed type for `"name" in movie_optional` is `bool`. +typeddicts_operations.py:86:0 Revealed type [-1]: Revealed type for `"other" in movie_optional` is `bool`. +typeddicts_operations.py:88:0 Undefined attribute [16]: `MovieOptional` has no attribute `clear`. +typeddicts_operations.py:89:0 Undefined attribute [16]: `MovieOptional` has no attribute `popitem`. +typeddicts_operations.py:96:4 Incompatible variable type [9]: movie_optional is declared to have type `MovieOptional` but is used as type `Dict[str, Union[int, str]]`. +typeddicts_operations.py:99:28 TypedDict accessed with a non-literal [26]: TypedDict key must be a string literal. Expected one of ('name', 'year'). +typeddicts_operations.py:100:32 TypedDict accessed with a non-literal [26]: TypedDict key must be a string literal. Expected one of ('name', 'year'). +typeddicts_operations.py:103:4 Revealed type [-1]: Revealed type for `existing_optional_movie[variable_key]` is `str`. +typeddicts_operations.py:103:40 TypedDict accessed with a non-literal [26]: TypedDict key must be a string literal. Expected one of ('name', 'year'). +typeddicts_operations.py:106:4 Revealed type [-1]: Revealed type for `variable_key in existing_optional_movie` is `bool`. """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index c60d20445..819259d8c 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.23" -test_duration = 3.9 +test_duration = 1.6 diff --git a/conformance/results/pyright/typeddicts_operations.toml b/conformance/results/pyright/typeddicts_operations.toml index 9eae54519..aeddfa4a5 100644 --- a/conformance/results/pyright/typeddicts_operations.toml +++ b/conformance/results/pyright/typeddicts_operations.toml @@ -1,4 +1,4 @@ -conformant = "Pass" +conformant = "Fail" output = """ typeddicts_operations.py:22:1 - error: Could not assign item in TypedDict   "Literal[1982]" is not assignable to "str" (reportGeneralTypeIssues) @@ -15,13 +15,38 @@ typeddicts_operations.py:29:42 - error: Type "dict[str, str | float]" is not ass typeddicts_operations.py:32:36 - error: Type "dict[str, str | int]" is not assignable to declared type "Movie"   "other" is an undefined item in type "Movie" (reportAssignmentType) typeddicts_operations.py:37:20 - error: Type "dict[str, str | int]" is not assignable to declared type "Movie" (reportAssignmentType) -typeddicts_operations.py:47:7 - error: Cannot access attribute "clear" for class "Movie" +typeddicts_operations.py:44:17 - information: Type of "existing_movie[variable_key]" is "Unknown" +typeddicts_operations.py:47:17 - information: Type of "variable_key in existing_movie" is "bool" +typeddicts_operations.py:48:17 - error: "assert_type" mismatch: expected "object | None" but received "Any | None" (reportAssertTypeFailure) +typeddicts_operations.py:58:13 - information: Type of ""other" in movie" is "bool" +typeddicts_operations.py:60:7 - error: Cannot access attribute "clear" for class "Movie"   Attribute "clear" is unknown (reportAttributeAccessIssue) -typeddicts_operations.py:49:5 - error: Could not delete item in TypedDict +typeddicts_operations.py:61:7 - error: Cannot access attribute "popitem" for class "Movie" +  Attribute "popitem" is unknown (reportAttributeAccessIssue) +typeddicts_operations.py:63:5 - error: Could not delete item in TypedDict   "name" is a required key and cannot be deleted (reportGeneralTypeIssues) -typeddicts_operations.py:62:16 - error: Cannot access attribute "clear" for class "MovieOptional" +typeddicts_operations.py:76:1 - error: Could not access item in TypedDict +  "name" is not a required key in "MovieOptional", so access may result in runtime exception (reportTypedDictNotRequiredAccess) +typeddicts_operations.py:80:13 - information: Type of "movie_optional.get("other")" is "Any | None" +typeddicts_operations.py:83:13 - information: Type of ""name" in movie_optional" is "bool" +typeddicts_operations.py:86:13 - information: Type of ""other" in movie_optional" is "bool" +typeddicts_operations.py:88:16 - error: Cannot access attribute "clear" for class "MovieOptional"   Attribute "clear" is unknown (reportAttributeAccessIssue) +typeddicts_operations.py:89:16 - error: Cannot access attribute "popitem" for class "MovieOptional" +  Attribute "popitem" is unknown (reportAttributeAccessIssue) +typeddicts_operations.py:96:37 - error: Type "dict[str, str | int]" is not assignable to declared type "MovieOptional" (reportAssignmentType) +typeddicts_operations.py:103:17 - information: Type of "existing_optional_movie[variable_key]" is "Unknown" +typeddicts_operations.py:106:17 - information: Type of "variable_key in existing_optional_movie" is "bool" +typeddicts_operations.py:107:17 - error: "assert_type" mismatch: expected "object | None" but received "Any | None" (reportAssertTypeFailure) """ -conformance_automated = "Pass" +conformance_automated = "Fail" errors_diff = """ +Line 40: Expected 1 errors +Line 41: Expected 1 errors +Line 44: Expected 1 errors +Line 99: Expected 1 errors +Line 100: Expected 1 errors +Line 103: Expected 1 errors +Line 48: Unexpected errors ['typeddicts_operations.py:48:17 - error: "assert_type" mismatch: expected "object | None" but received "Any | None" (reportAssertTypeFailure)'] +Line 107: Unexpected errors ['typeddicts_operations.py:107:17 - error: "assert_type" mismatch: expected "object | None" but received "Any | None" (reportAssertTypeFailure)'] """ diff --git a/conformance/results/pyright/version.toml b/conformance/results/pyright/version.toml index 3df68e70d..3eb56816d 100644 --- a/conformance/results/pyright/version.toml +++ b/conformance/results/pyright/version.toml @@ -1,2 +1,2 @@ version = "pyright 1.1.399" -test_duration = 2.5 +test_duration = 2.4 diff --git a/conformance/results/pytype/typeddicts_operations.toml b/conformance/results/pytype/typeddicts_operations.toml index a01d0edeb..d728528e9 100644 --- a/conformance/results/pytype/typeddicts_operations.toml +++ b/conformance/results/pytype/typeddicts_operations.toml @@ -26,11 +26,91 @@ typeddicts_operations.py:37:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in f movie: Movie = {variable_key: "", "year": 1900} # E: variable key \u001b[1m\u001b[31m~~~~~\u001b[39m\u001b[0m -typeddicts_operations.py:60:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : str [assert-type] +typeddicts_operations.py:40:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func1: TypedDict Movie requires all keys to be constant strings [typed-dict-error] + + existing_movie[variable_key] = 1982 # E: variable key + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:41:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func1: TypedDict Movie requires all keys to be constant strings [typed-dict-error] + + del existing_movie[variable_key] # E + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:44:17: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func1: TypedDict Movie requires all keys to be constant strings [typed-dict-error] + + reveal_type(existing_movie[variable_key]) # E + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:44:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func1: Any [reveal-type] + + reveal_type(existing_movie[variable_key]) # E + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:47:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func1: bool [reveal-type] + + reveal_type(variable_key in existing_movie) # `bool` + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:48:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func1: None [assert-type] + + assert_type(existing_movie.get(variable_key), object | None) + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:58:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : bool [reveal-type] + +reveal_type("other" in movie) # E? +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:77:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : str [assert-type] assert_type(movie_optional.get("name"), str | None) \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m +typeddicts_operations.py:80:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : None [reveal-type] + +reveal_type(movie_optional.get("other")) # E? +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:83:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : bool [reveal-type] + +reveal_type("name" in movie_optional) # E? +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:86:1: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : bool [reveal-type] + +reveal_type("other" in movie_optional) # E? +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:99:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func2: TypedDict MovieOptional requires all keys to be constant strings [typed-dict-error] + + existing_optional_movie[variable_key] = 1982 # E: variable key + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:100:9: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func2: TypedDict MovieOptional requires all keys to be constant strings [typed-dict-error] + + del existing_optional_movie[variable_key] # E: variable key + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:103:17: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func2: TypedDict MovieOptional requires all keys to be constant strings [typed-dict-error] + + reveal_type(existing_optional_movie[variable_key]) # E + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:103:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func2: Any [reveal-type] + + reveal_type(existing_optional_movie[variable_key]) # E + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:106:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func2: bool [reveal-type] + + reveal_type(variable_key in existing_optional_movie) # `bool` + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + +typeddicts_operations.py:107:5: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in func2: None [assert-type] + + assert_type(existing_optional_movie.get(variable_key), object | None) + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m + """ conformance_automated = "Fail" errors_diff = """ @@ -38,8 +118,15 @@ Line 22: Expected 1 errors Line 23: Expected 1 errors Line 24: Expected 1 errors Line 26: Expected 1 errors -Line 47: Expected 1 errors -Line 49: Expected 1 errors -Line 62: Expected 1 errors -Line 60: Unexpected errors ['typeddicts_operations.py:60:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : str [assert-type]'] +Line 60: Expected 1 errors +Line 61: Expected 1 errors +Line 63: Expected 1 errors +Line 88: Expected 1 errors +Line 89: Expected 1 errors +Line 96: Expected 1 errors +Line 47: Unexpected errors ['typeddicts_operations.py:47:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func1: bool [reveal-type]'] +Line 48: Unexpected errors ['typeddicts_operations.py:48:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func1: None [assert-type]'] +Line 77: Unexpected errors ['typeddicts_operations.py:77:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : str [assert-type]'] +Line 106: Unexpected errors ['typeddicts_operations.py:106:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func2: bool [reveal-type]'] +Line 107: Unexpected errors ['typeddicts_operations.py:107:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func2: None [assert-type]'] """ diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index 70cfb40b1..631ca6cf3 100644 --- a/conformance/results/pytype/version.toml +++ b/conformance/results/pytype/version.toml @@ -1,2 +1,2 @@ version = "pytype 2024.10.11" -test_duration = 42.2 +test_duration = 37.8 diff --git a/conformance/results/results.html b/conformance/results/results.html index 74bd91aaf..26dceb37e 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -159,16 +159,16 @@

Python Type System Conformance Test Results

 
mypy 1.15.0
-
2.1sec
+
1.9sec
pyright 1.1.399
-
2.5sec
+
2.4sec
pyre 0.9.23
-
3.9sec
+
1.6sec
pytype 2024.10.11
-
42.2sec
+
37.8sec