Skip to content

Commit cae1030

Browse files
committed
stubgen: update test-data
1 parent 2148354 commit cae1030

File tree

1 file changed

+29
-52
lines changed

1 file changed

+29
-52
lines changed

test-data/unit/stubgen.test

Lines changed: 29 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,38 @@ def g(arg): ...
2020
def f(a, b=2): ...
2121
def 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]
2727
def f(x=None): ...
2828
[out]
29-
def f(x=None): ...
29+
def f(x: Optional[Any] = ...): ...
3030

3131
[case testDefaultArgBool]
3232
def 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]
3737
def f(x='foo'): ...
3838
[out]
39-
def f(x=''): ...
39+
def f(x: str = ...): ...
4040

4141
[case testDefaultArgBytes]
4242
def f(x=b'foo'): ...
4343
[out]
44-
def f(x=b''): ...
44+
def f(x: bytes = ...): ...
4545

4646
[case testDefaultArgFloat]
4747
def f(x=1.2): ...
4848
[out]
49-
def f(x=0.0): ...
49+
def f(x: float = ...): ...
5050

5151
[case testDefaultArgOther]
5252
def f(x=ord): ...
5353
[out]
54-
def f(x=...): ...
54+
def f(x: Any = ...): ...
5555

5656
[case testVarArgs]
5757
def f(x, *y): ...
@@ -77,38 +77,30 @@ def g(): ...
7777
[case testVariable]
7878
x = 1
7979
[out]
80-
from typing import Any
81-
82-
x = ... # type: Any
80+
x = ... # type: int
8381

8482
[case testMultipleVariable]
8583
x = 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]
9389
class C:
9490
x = 1
9591
[out]
96-
from typing import Any
97-
9892
class C:
99-
x = ... # type: Any
93+
x = ... # type: int
10094

10195
[case testSelfAssignment]
10296
class C:
10397
def __init__(self):
10498
self.x = 1
10599
x.y = 2
106100
[out]
107-
from typing import Any
108-
109101
class C:
110-
x = ... # type: Any
111-
def __init__(self): ...
102+
x = ... # type: int
103+
def __init__(self) -> None: ...
112104

113105
[case testSelfAndClassBodyAssignment]
114106
x = 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

125115
class C:
126-
x = ... # type: Any
127-
def __init__(self): ...
116+
x = ... # type: int
117+
def __init__(self) -> None: ...
128118

129119
[case testEmptyClass]
130120
class A: ...
@@ -172,25 +162,21 @@ def foo(x): ...
172162
[case testMultipleAssignment]
173163
x, 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]
189175
def f(x, *, y=1): ...
190176
def 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]
196182
class A:
@@ -311,10 +297,8 @@ class A:
311297
x = 1
312298
def f(self): ...
313299
[out]
314-
from typing import Any
315-
316300
class 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']
333317
x = 1
334318
[out]
335-
from typing import Any
336319
from re import match as match, sub as sub
337320

338-
x = ... # type: Any
321+
x = ... # type: int
339322

340323
[case testExportModule_import]
341324
import re
342325
__all__ = ['re', 'x']
343326
x = 1
344327
y = 2
345328
[out]
346-
from typing import Any
347329
import re as re
348330

349-
x = ... # type: Any
331+
x = ... # type: int
350332

351333
[case testExportModuleAs_import]
352334
import re as rex
353335
__all__ = ['rex', 'x']
354336
x = 1
355337
y = 2
356338
[out]
357-
from typing import Any
358339
import re as rex
359340

360-
x = ... # type: Any
341+
x = ... # type: int
361342

362343
[case testExportModuleInPackage_import]
363344
import urllib.parse as p
@@ -384,11 +365,9 @@ x = 1
384365
class C:
385366
def g(self): ...
386367
[out]
387-
from typing import Any
388-
389368
def f(): ...
390369

391-
x = ... # type: Any
370+
x = ... # type: int
392371

393372
class 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-
526503
class A:
527504
class B:
528-
x = ... # type: Any
505+
x = ... # type: int
529506
def f(self): ...
530507
def g(self): ...
531508

0 commit comments

Comments
 (0)