Skip to content

Commit c352f83

Browse files
committed
Update existing tests to pass
1 parent 0615f08 commit c352f83

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

test-data/unit/check-functions.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,8 +1397,8 @@ if g(C()):
13971397
f = [] # E: Need type annotation for 'f'
13981398
if object():
13991399
def f(): pass # E: Incompatible redefinition
1400-
f()
1401-
f(1)
1400+
f() # E: "List[Any]" not callable
1401+
f(1) # E: "List[Any]" not callable
14021402
[builtins fixtures/list.pyi]
14031403

14041404
[case testDefineConditionallyAsImportedAndDecorated]

test-data/unit/check-inference.test

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,15 +1291,15 @@ a = [] # E: Need type annotation for 'a'
12911291
[case testInferListInitializedToEmptyAndReadBeforeAppend]
12921292
a = [] # E: Need type annotation for 'a'
12931293
if a: pass
1294-
a.xyz
1294+
a.xyz # E: "List[Any]" has no attribute "xyz"
12951295
a.append('')
12961296
[builtins fixtures/list.pyi]
12971297
[out]
12981298

12991299
[case testInferListInitializedToEmptyAndIncompleteTypeInAppend]
13001300
a = [] # E: Need type annotation for 'a'
13011301
a.append([])
1302-
a()
1302+
a() # E: "List[Any]" not callable
13031303
[builtins fixtures/list.pyi]
13041304
[out]
13051305

@@ -1335,7 +1335,7 @@ a.append(1)
13351335
def f() -> None:
13361336
a = [] # E: Need type annotation for 'a'
13371337
if a: pass
1338-
a.xyz
1338+
a.xyz # E: "List[Any]" has no attribute "xyz"
13391339
a.append('')
13401340
[builtins fixtures/list.pyi]
13411341
[out]
@@ -1392,8 +1392,9 @@ class A:
13921392
self.x = [] # E: Need type annotation for 'x'
13931393

13941394
class B(A):
1395+
# TODO?: This error is kind of a false positive, unfortunately
13951396
@property
1396-
def x(self) -> List[int]:
1397+
def x(self) -> List[int]: # E: Signature of "x" incompatible with supertype "A"
13971398
return [123]
13981399
[builtins fixtures/list.pyi]
13991400
[out]
@@ -1435,8 +1436,8 @@ a() # E: "Dict[str, int]" not callable
14351436

14361437
[case testInferDictInitializedToEmptyUsingUpdateError]
14371438
a = {} # E: Need type annotation for 'a'
1438-
a.update([1, 2])
1439-
a()
1439+
a.update([1, 2]) # E: Argument 1 to "update" of "dict" has incompatible type "List[int]"; expected "Mapping[Any, Any]"
1440+
a() # E: "Dict[Any, Any]" not callable
14401441
[builtins fixtures/dict.pyi]
14411442
[out]
14421443

@@ -2157,8 +2158,8 @@ class A:
21572158
def f(self) -> None:
21582159
self.x[0] = ''
21592160

2160-
reveal_type(A().x) # E: Revealed type is 'Any'
2161-
reveal_type(A.x) # E: Revealed type is 'Any'
2161+
reveal_type(A().x) # E: Revealed type is 'builtins.dict[Any, Any]'
2162+
reveal_type(A.x) # E: Revealed type is 'builtins.dict[Any, Any]'
21622163
[builtins fixtures/dict.pyi]
21632164

21642165
[case testLocalPartialTypesWithGlobalInitializedToEmptyList]
@@ -2179,9 +2180,9 @@ a = [] # E: Need type annotation for 'a'
21792180

21802181
def f() -> None:
21812182
a.append(1)
2182-
reveal_type(a) # E: Revealed type is 'Any'
2183+
reveal_type(a) # E: Revealed type is 'builtins.list[Any]'
21832184

2184-
reveal_type(a) # E: Revealed type is 'Any'
2185+
reveal_type(a) # E: Revealed type is 'builtins.list[Any]'
21852186
[builtins fixtures/list.pyi]
21862187

21872188
[case testLocalPartialTypesWithGlobalInitializedToEmptyList3]
@@ -2191,7 +2192,7 @@ a = [] # E: Need type annotation for 'a'
21912192
def f():
21922193
a.append(1)
21932194

2194-
reveal_type(a) # E: Revealed type is 'Any'
2195+
reveal_type(a) # E: Revealed type is 'builtins.list[Any]'
21952196
[builtins fixtures/list.pyi]
21962197

21972198
[case testLocalPartialTypesWithGlobalInitializedToEmptyDict]
@@ -2212,9 +2213,9 @@ a = {} # E: Need type annotation for 'a'
22122213

22132214
def f() -> None:
22142215
a[0] = ''
2215-
reveal_type(a) # E: Revealed type is 'Any'
2216+
reveal_type(a) # E: Revealed type is 'builtins.dict[Any, Any]'
22162217

2217-
reveal_type(a) # E: Revealed type is 'Any'
2218+
reveal_type(a) # E: Revealed type is 'builtins.dict[Any, Any]'
22182219
[builtins fixtures/dict.pyi]
22192220

22202221
[case testLocalPartialTypesWithGlobalInitializedToEmptyDict3]
@@ -2224,7 +2225,7 @@ a = {} # E: Need type annotation for 'a'
22242225
def f():
22252226
a[0] = ''
22262227

2227-
reveal_type(a) # E: Revealed type is 'Any'
2228+
reveal_type(a) # E: Revealed type is 'builtins.dict[Any, Any]'
22282229
[builtins fixtures/dict.pyi]
22292230

22302231
[case testLocalPartialTypesWithNestedFunction]

0 commit comments

Comments
 (0)