@@ -1728,12 +1728,14 @@ b[{}] = 1
1728
1728
[builtins fixtures/dict.pyi]
1729
1729
1730
1730
[case testInferDictInitializedToEmptyAndUpdatedFromMethod]
1731
+ # flags: --no-local-partial-types
1731
1732
map = {}
1732
1733
def add() -> None:
1733
1734
map[1] = 2
1734
1735
[builtins fixtures/dict.pyi]
1735
1736
1736
1737
[case testInferDictInitializedToEmptyAndUpdatedFromMethodUnannotated]
1738
+ # flags: --no-local-partial-types
1737
1739
map = {}
1738
1740
def add():
1739
1741
map[1] = 2
@@ -1921,6 +1923,7 @@ reveal_type(C().a) # N: Revealed type is "builtins.dict[Any, Any]"
1921
1923
[builtins fixtures/dict.pyi]
1922
1924
1923
1925
[case testInferAttributeInitializedToNoneAndAssignedClassBody]
1926
+ # flags: --no-local-partial-types
1924
1927
class C:
1925
1928
a = None
1926
1929
def __init__(self) -> None:
@@ -2069,6 +2072,7 @@ x = 1
2069
2072
[out]
2070
2073
2071
2074
[case testPartiallyInitializedVariableDoesNotEscapeScope2]
2075
+ # flags: --no-local-partial-types
2072
2076
x = None
2073
2077
def f() -> None:
2074
2078
x = None
@@ -2114,36 +2118,32 @@ class C:
2114
2118
-- ------------------------
2115
2119
2116
2120
[case testPartialTypeErrorSpecialCase1]
2121
+ # flags: --no-local-partial-types
2117
2122
# This used to crash.
2118
2123
class A:
2119
2124
x = None
2120
2125
def f(self) -> None:
2121
- for a in self.x:
2126
+ for a in self.x: # E: "None" has no attribute "__iter__" (not iterable)
2122
2127
pass
2123
2128
[builtins fixtures/for.pyi]
2124
- [out]
2125
- main:5: error: "None" has no attribute "__iter__" (not iterable)
2126
2129
2127
2130
[case testPartialTypeErrorSpecialCase2]
2128
2131
# This used to crash.
2129
2132
class A:
2130
- x = []
2133
+ x = [] # E: Need type annotation for "x" (hint: "x: List[<type>] = ...")
2131
2134
def f(self) -> None:
2132
2135
for a in self.x:
2133
2136
pass
2134
2137
[builtins fixtures/for.pyi]
2135
- [out]
2136
- main:3: error: Need type annotation for "x" (hint: "x: List[<type>] = ...")
2137
2138
2138
2139
[case testPartialTypeErrorSpecialCase3]
2140
+ # flags: --no-local-partial-types
2139
2141
class A:
2140
2142
x = None
2141
2143
def f(self) -> None:
2142
- for a in A.x:
2144
+ for a in A.x: # E: "None" has no attribute "__iter__" (not iterable)
2143
2145
pass
2144
2146
[builtins fixtures/for.pyi]
2145
- [out]
2146
- main:4: error: "None" has no attribute "__iter__" (not iterable)
2147
2147
2148
2148
[case testPartialTypeErrorSpecialCase4]
2149
2149
# This used to crash.
@@ -2492,6 +2492,7 @@ main:4: error: Unsupported target for indexed assignment ("Type[C[T]]")
2492
2492
main:4: error: Invalid type: try using Literal[0] instead?
2493
2493
2494
2494
[case testNoCrashOnPartialMember]
2495
+ # flags: --no-local-partial-types
2495
2496
class C:
2496
2497
x = None
2497
2498
def __init__(self) -> None:
@@ -2512,6 +2513,7 @@ reveal_type(x) # N: Revealed type is "builtins.str"
2512
2513
[out]
2513
2514
2514
2515
[case testNoCrashOnPartialVariable2]
2516
+ # flags: --no-local-partial-types
2515
2517
from typing import Tuple, TypeVar
2516
2518
T = TypeVar('T', bound=str)
2517
2519
0 commit comments