File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -3705,6 +3705,34 @@ def foo() -> None:
37053705==
37063706b.py:4: error: Incompatible types in assignment (expression has type "str", variable has type "int")
37073707
3708+ [case testTypedDictUpdateReadOnly]
3709+ import b
3710+ [file a.py]
3711+ from typing_extensions import TypedDict, ReadOnly
3712+ Point = TypedDict('Point', {'x': int, 'y': int})
3713+ p = Point(x=1, y=2)
3714+ [file a.py.2]
3715+ from typing_extensions import TypedDict, ReadOnly
3716+ class Point(TypedDict):
3717+ x: int
3718+ y: ReadOnly[int]
3719+ p = Point(x=1, y=2)
3720+ [file a.py.3]
3721+ from typing_extensions import TypedDict, ReadOnly
3722+ Point = TypedDict('Point', {'x': ReadOnly[int], 'y': int})
3723+ p = Point(x=1, y=2)
3724+ [file b.py]
3725+ from a import Point
3726+ def foo(x: Point) -> None:
3727+ x['x'] = 1
3728+ x['y'] = 2
3729+ [builtins fixtures/dict.pyi]
3730+ [out]
3731+ ==
3732+ b.py:4: error: ReadOnly TypedDict key "y" TypedDict is mutated
3733+ ==
3734+ b.py:3: error: ReadOnly TypedDict key "x" TypedDict is mutated
3735+
37083736[case testBasicAliasUpdate]
37093737import b
37103738[file a.py]
You can’t perform that action at this time.
0 commit comments