Skip to content

Commit d46f0a5

Browse files
committed
typeddicts - reading not required keys
1 parent 29d155a commit d46f0a5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

conformance/tests/typeddicts_operations.py

+3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ class MovieOptional(TypedDict, total=False):
6969

7070
movie_optional: MovieOptional = {}
7171

72+
# > Type checkers may allow reading an item using d['x']
73+
# even if the key 'x' is not required.
74+
movie_optional["name"] # E?
7275
assert_type(movie_optional.get("name"), str | None)
7376

7477
movie_optional.clear() # E: clear not allowed

0 commit comments

Comments
 (0)