@@ -2017,9 +2017,7 @@ v = {bad2: 2} # E: Missing key "num" for TypedDict "Value" \
2017
2017
[case testOperatorContainsNarrowsTypedDicts_unionWithList]
2018
2018
from __future__ import annotations
2019
2019
from typing import assert_type, TypedDict, Union
2020
- from typing_extensions import final
2021
2020
2022
- @final
2023
2021
class D(TypedDict):
2024
2022
foo: int
2025
2023
@@ -2041,12 +2039,10 @@ from __future__ import annotations
2041
2039
from typing import assert_type, Literal, TypedDict, TypeVar, Union
2042
2040
from typing_extensions import final
2043
2041
2044
- @final
2045
2042
class D1(TypedDict):
2046
2043
foo: int
2047
2044
2048
2045
2049
- @final
2050
2046
class D2(TypedDict):
2051
2047
bar: int
2052
2048
@@ -2087,50 +2083,6 @@ def f(arg: TD) -> None:
2087
2083
[builtins fixtures/dict.pyi]
2088
2084
[typing fixtures/typing-typeddict.pyi]
2089
2085
2090
- [case testOperatorContainsNarrowsTypedDicts_final]
2091
- # flags: --warn-unreachable
2092
- from __future__ import annotations
2093
- from typing import assert_type, TypedDict, Union
2094
- from typing_extensions import final
2095
-
2096
- @final
2097
- class DFinal(TypedDict):
2098
- foo: int
2099
-
2100
-
2101
- class DNotFinal(TypedDict):
2102
- bar: int
2103
-
2104
-
2105
- d_not_final: DNotFinal
2106
-
2107
- if 'bar' in d_not_final:
2108
- assert_type(d_not_final, DNotFinal)
2109
- else:
2110
- spam = 'ham' # E: Statement is unreachable
2111
-
2112
- if 'spam' in d_not_final:
2113
- assert_type(d_not_final, DNotFinal)
2114
- else:
2115
- assert_type(d_not_final, DNotFinal)
2116
-
2117
- d_final: DFinal
2118
-
2119
- if 'spam' in d_final:
2120
- spam = 'ham' # E: Statement is unreachable
2121
- else:
2122
- assert_type(d_final, DFinal)
2123
-
2124
- d_union: DFinal | DNotFinal
2125
-
2126
- if 'foo' in d_union:
2127
- assert_type(d_union, Union[DFinal, DNotFinal])
2128
- else:
2129
- assert_type(d_union, DNotFinal)
2130
-
2131
- [builtins fixtures/dict.pyi]
2132
- [typing fixtures/typing-typeddict.pyi]
2133
-
2134
2086
[case testOperatorContainsNarrowsTypedDicts_partialThroughTotalFalse]
2135
2087
from __future__ import annotations
2136
2088
from typing import assert_type, Literal, TypedDict, Union
0 commit comments