@@ -20,38 +20,38 @@ def g(arg): ...
2020def f(a, b=2): ...
2121def g(b=-1, c=0): ...
2222[out]
23- def f(a, b=2 ): ...
24- def g(b=-1 , c=0 ): ...
23+ def f(a, b: int = ... ): ...
24+ def g(b: int = ... , c: int = ... ): ...
2525
2626[case testDefaultArgNone]
2727def f(x=None): ...
2828[out]
29- def f(x=None ): ...
29+ def f(x: Optional[Any] = ... ): ...
3030
3131[case testDefaultArgBool]
3232def f(x=True, y=False): ...
3333[out]
34- def f(x=True , y=False ): ...
34+ def f(x: bool = ... , y: bool = ... ): ...
3535
3636[case testDefaultArgStr]
3737def f(x='foo'): ...
3838[out]
39- def f(x='' ): ...
39+ def f(x: str = ... ): ...
4040
4141[case testDefaultArgBytes]
4242def f(x=b'foo'): ...
4343[out]
44- def f(x=b'' ): ...
44+ def f(x: bytes = ... ): ...
4545
4646[case testDefaultArgFloat]
4747def f(x=1.2): ...
4848[out]
49- def f(x=0.0 ): ...
49+ def f(x: float = ... ): ...
5050
5151[case testDefaultArgOther]
5252def f(x=ord): ...
5353[out]
54- def f(x= ...): ...
54+ def f(x: Any = ...): ...
5555
5656[case testVarArgs]
5757def f(x, *y): ...
@@ -77,38 +77,30 @@ def g(): ...
7777[case testVariable]
7878x = 1
7979[out]
80- from typing import Any
81-
82- x = ... # type: Any
80+ x = ... # type: int
8381
8482[case testMultipleVariable]
8583x = y = 1
8684[out]
87- from typing import Any
88-
89- x = ... # type: Any
90- y = ... # type: Any
85+ x = ... # type: int
86+ y = ... # type: int
9187
9288[case testClassVariable]
9389class C:
9490 x = 1
9591[out]
96- from typing import Any
97-
9892class C:
99- x = ... # type: Any
93+ x = ... # type: int
10094
10195[case testSelfAssignment]
10296class C:
10397 def __init__(self):
10498 self.x = 1
10599 x.y = 2
106100[out]
107- from typing import Any
108-
109101class C:
110- x = ... # type: Any
111- def __init__(self): ...
102+ x = ... # type: int
103+ def __init__(self) -> None : ...
112104
113105[case testSelfAndClassBodyAssignment]
114106x = 1
@@ -118,13 +110,11 @@ class C:
118110 self.x = 1
119111 self.x = 1
120112[out]
121- from typing import Any
122-
123- x = ... # type: Any
113+ x = ... # type: int
124114
125115class C:
126- x = ... # type: Any
127- def __init__(self): ...
116+ x = ... # type: int
117+ def __init__(self) -> None : ...
128118
129119[case testEmptyClass]
130120class A: ...
@@ -172,25 +162,21 @@ def foo(x): ...
172162[case testMultipleAssignment]
173163x, y = 1, 2
174164[out]
175- from typing import Any
176-
177- x = ... # type: Any
178- y = ... # type: Any
165+ x = ... # type: int
166+ y = ... # type: int
179167
180168[case testMultipleAssignment2]
181169[x, y] = 1, 2
182170[out]
183- from typing import Any
184-
185- x = ... # type: Any
186- y = ... # type: Any
171+ x = ... # type: int
172+ y = ... # type: int
187173
188174[case testKeywordOnlyArg]
189175def f(x, *, y=1): ...
190176def g(x, *, y=1, z=2): ...
191177[out]
192- def f(x, *, y=1 ): ...
193- def g(x, *, y=1 , z=2 ): ...
178+ def f(x, *, y: int = ... ): ...
179+ def g(x, *, y: int = ... , z: int = ... ): ...
194180
195181[case testProperty]
196182class A:
@@ -311,10 +297,8 @@ class A:
311297 x = 1
312298 def f(self): ...
313299[out]
314- from typing import Any
315-
316300class A:
317- x = ... # type: Any
301+ x = ... # type: int
318302 def f(self): ...
319303
320304[case testMultiplePrivateDefs]
@@ -332,32 +316,29 @@ from re import match, search, sub
332316__all__ = ['match', 'sub', 'x']
333317x = 1
334318[out]
335- from typing import Any
336319from re import match as match, sub as sub
337320
338- x = ... # type: Any
321+ x = ... # type: int
339322
340323[case testExportModule_import]
341324import re
342325__all__ = ['re', 'x']
343326x = 1
344327y = 2
345328[out]
346- from typing import Any
347329import re as re
348330
349- x = ... # type: Any
331+ x = ... # type: int
350332
351333[case testExportModuleAs_import]
352334import re as rex
353335__all__ = ['rex', 'x']
354336x = 1
355337y = 2
356338[out]
357- from typing import Any
358339import re as rex
359340
360- x = ... # type: Any
341+ x = ... # type: int
361342
362343[case testExportModuleInPackage_import]
363344import urllib.parse as p
@@ -384,11 +365,9 @@ x = 1
384365class C:
385366 def g(self): ...
386367[out]
387- from typing import Any
388-
389368def f(): ...
390369
391- x = ... # type: Any
370+ x = ... # type: int
392371
393372class C:
394373 def g(self): ...
@@ -521,11 +500,9 @@ class A:
521500 def f(self): ...
522501 def g(self): ...
523502[out]
524- from typing import Any
525-
526503class A:
527504 class B:
528- x = ... # type: Any
505+ x = ... # type: int
529506 def f(self): ...
530507 def g(self): ...
531508
0 commit comments