Skip to content

Commit 26f812e

Browse files
committed
typeddicts - test unspecified operations with extra keys
1 parent 7ccaafa commit 26f812e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

conformance/tests/typeddicts_operations.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def func1(variable_key: str, existing_movie: Movie):
5454
# It's not clear from the spec what type this should be.
5555
movie.get("other") # E?
5656

57+
# It's not clear from the spec whether it's allowed.
58+
reveal_type("other" in movie) # E?
5759

5860
movie.clear() # E: clear not allowed
5961
movie.popitem() # E: popitem not allowed
@@ -74,9 +76,15 @@ class MovieOptional(TypedDict, total=False):
7476
movie_optional["name"] # E?
7577
assert_type(movie_optional.get("name"), str | None)
7678

79+
# It's not clear from the spec what type this should be.
80+
reveal_type(movie_optional.get("other")) # E?
81+
7782
# > Type checkers may allow 'x' in d even if the key 'x' is not required.
7883
reveal_type("name" in movie_optional) # E?
7984

85+
# It's not clear from the spec whether it's allowed.
86+
reveal_type("other" in movie_optional) # E?
87+
8088
movie_optional.clear() # E: clear not allowed
8189
movie_optional.popitem() # E: popitem not allowed
8290

0 commit comments

Comments
 (0)