diff --git a/conformance/results/mypy/typeddicts_operations.toml b/conformance/results/mypy/typeddicts_operations.toml index 64839b9d..d9a02245 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 6bd36c63..95a6c1a9 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 e8b1cf65..1b72db14 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 c60d2044..819259d8 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 9eae5451..aeddfa4a 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 8fb908ad..3eb56816 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.4 diff --git a/conformance/results/pytype/protocols_merging.toml b/conformance/results/pytype/protocols_merging.toml index a3102a96..28275fdd 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/typeddicts_operations.toml b/conformance/results/pytype/typeddicts_operations.toml index a01d0ede..d728528e 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 cdc0a953..631ca6cf 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 = 37.8 diff --git a/conformance/results/results.html b/conformance/results/results.html index d78bd912..26dceb37 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -159,16 +159,16 @@

Python Type System Conformance Test Results

- - + - + diff --git a/conformance/tests/typeddicts_operations.py b/conformance/tests/typeddicts_operations.py index f334f956..8461cfed 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") @@ -43,8 +54,11 @@ def func1(variable_key: str): # 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 del movie["name"] # E: del not allowed for required key @@ -57,8 +71,34 @@ 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) +# 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 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)
 
mypy 1.15.0
-
2.1sec
+
1.9sec
pyright 1.1.398
-
2.3sec
+
pyright 1.1.399
+
2.4sec
pyre 0.9.23
-
3.9sec
+
1.6sec
pytype 2024.10.11
-
43.3sec
+
37.8sec
@@ -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.