Skip to content

Commit 6c0cd9c

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

File tree

1 file changed

+29
-44
lines changed

1 file changed

+29
-44
lines changed

test-data/unit/stubgen.test

Lines changed: 29 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,42 @@ 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+
from typing import Any, Optional
30+
31+
def f(x: Optional[Any] = ...): ...
3032

3133
[case testDefaultArgBool]
3234
def f(x=True, y=False): ...
3335
[out]
34-
def f(x=True, y=False): ...
36+
def f(x: bool = ..., y: bool = ...): ...
3537

3638
[case testDefaultArgStr]
3739
def f(x='foo'): ...
3840
[out]
39-
def f(x=''): ...
41+
def f(x: str = ...): ...
4042

4143
[case testDefaultArgBytes]
4244
def f(x=b'foo'): ...
4345
[out]
44-
def f(x=b''): ...
46+
def f(x: bytes = ...): ...
4547

4648
[case testDefaultArgFloat]
4749
def f(x=1.2): ...
4850
[out]
49-
def f(x=0.0): ...
51+
def f(x: float = ...): ...
5052

5153
[case testDefaultArgOther]
5254
def f(x=ord): ...
5355
[out]
54-
def f(x=...): ...
56+
from typing import Any
57+
58+
def f(x: Any = ...): ...
5559

5660
[case testVarArgs]
5761
def f(x, *y): ...
@@ -77,38 +81,30 @@ def g(): ...
7781
[case testVariable]
7882
x = 1
7983
[out]
80-
from typing import Any
81-
82-
x = ... # type: Any
84+
x = ... # type: int
8385

8486
[case testMultipleVariable]
8587
x = y = 1
8688
[out]
87-
from typing import Any
88-
89-
x = ... # type: Any
90-
y = ... # type: Any
89+
x = ... # type: int
90+
y = ... # type: int
9191

9292
[case testClassVariable]
9393
class C:
9494
x = 1
9595
[out]
96-
from typing import Any
97-
9896
class C:
99-
x = ... # type: Any
97+
x = ... # type: int
10098

10199
[case testSelfAssignment]
102100
class C:
103101
def __init__(self):
104102
self.x = 1
105103
x.y = 2
106104
[out]
107-
from typing import Any
108-
109105
class C:
110-
x = ... # type: Any
111-
def __init__(self): ...
106+
x = ... # type: int
107+
def __init__(self) -> None: ...
112108

113109
[case testSelfAndClassBodyAssignment]
114110
x = 1
@@ -118,13 +114,11 @@ class C:
118114
self.x = 1
119115
self.x = 1
120116
[out]
121-
from typing import Any
122-
123-
x = ... # type: Any
117+
x = ... # type: int
124118

125119
class C:
126-
x = ... # type: Any
127-
def __init__(self): ...
120+
x = ... # type: int
121+
def __init__(self) -> None: ...
128122

129123
[case testEmptyClass]
130124
class A: ...
@@ -189,8 +183,8 @@ y = ... # type: Any
189183
def f(x, *, y=1): ...
190184
def g(x, *, y=1, z=2): ...
191185
[out]
192-
def f(x, *, y=1): ...
193-
def g(x, *, y=1, z=2): ...
186+
def f(x, *, y: int = ...): ...
187+
def g(x, *, y: int = ..., z: int = ...): ...
194188

195189
[case testProperty]
196190
class A:
@@ -311,10 +305,8 @@ class A:
311305
x = 1
312306
def f(self): ...
313307
[out]
314-
from typing import Any
315-
316308
class A:
317-
x = ... # type: Any
309+
x = ... # type: int
318310
def f(self): ...
319311

320312
[case testMultiplePrivateDefs]
@@ -332,32 +324,29 @@ from re import match, search, sub
332324
__all__ = ['match', 'sub', 'x']
333325
x = 1
334326
[out]
335-
from typing import Any
336327
from re import match as match, sub as sub
337328

338-
x = ... # type: Any
329+
x = ... # type: int
339330

340331
[case testExportModule_import]
341332
import re
342333
__all__ = ['re', 'x']
343334
x = 1
344335
y = 2
345336
[out]
346-
from typing import Any
347337
import re as re
348338

349-
x = ... # type: Any
339+
x = ... # type: int
350340

351341
[case testExportModuleAs_import]
352342
import re as rex
353343
__all__ = ['rex', 'x']
354344
x = 1
355345
y = 2
356346
[out]
357-
from typing import Any
358347
import re as rex
359348

360-
x = ... # type: Any
349+
x = ... # type: int
361350

362351
[case testExportModuleInPackage_import]
363352
import urllib.parse as p
@@ -384,11 +373,9 @@ x = 1
384373
class C:
385374
def g(self): ...
386375
[out]
387-
from typing import Any
388-
389376
def f(): ...
390377

391-
x = ... # type: Any
378+
x = ... # type: int
392379

393380
class C:
394381
def g(self): ...
@@ -521,11 +508,9 @@ class A:
521508
def f(self): ...
522509
def g(self): ...
523510
[out]
524-
from typing import Any
525-
526511
class A:
527512
class B:
528-
x = ... # type: Any
513+
x = ... # type: int
529514
def f(self): ...
530515
def g(self): ...
531516

0 commit comments

Comments
 (0)