Skip to content

Commit 81f9ed0

Browse files
committed
Test case from no error to error
1 parent 8a562a8 commit 81f9ed0

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

test-data/unit/fine-grained.test

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3788,6 +3788,40 @@ b.py:4: error: TypedDict "A" has no key "b"
37883788
b.py:9: error: TypedDict "B" has no key "a"
37893789
==
37903790

3791+
[case testTypedDictUpdateClosedPassingToFailing]
3792+
import b
3793+
[file a.py]
3794+
from typing import TypedDict, Union
3795+
class A(TypedDict, closed=True):
3796+
a: int
3797+
class B(TypedDict, closed=True):
3798+
b: int
3799+
C = Union[A, B]
3800+
[file a.py.2]
3801+
from typing import TypedDict, Union
3802+
class A(TypedDict):
3803+
a: int
3804+
class B(TypedDict, closed=True):
3805+
b: int
3806+
C = Union[A, B]
3807+
[file b.py]
3808+
from a import C
3809+
def foo(x: C) -> int:
3810+
if "b" in x:
3811+
return x["b"]
3812+
else:
3813+
return x["a"]
3814+
def bar(x: C) -> int:
3815+
if "a" in x:
3816+
return x["a"]
3817+
else:
3818+
return x["b"]
3819+
[builtins fixtures/dict.pyi]
3820+
[typing fixtures/typing-typeddict.pyi]
3821+
[out]
3822+
==
3823+
b.py:4: error: TypedDict "A" has no key "b"
3824+
37913825
[case testBasicAliasUpdate]
37923826
import b
37933827
[file a.py]

0 commit comments

Comments
 (0)