@@ -109,13 +109,6 @@ f(re.match('x*', 'xxy'))
109
109
[out]
110
110
xx
111
111
112
- [case testVariableLengthTuple_python2]
113
- from typing import Tuple, cast
114
- x = cast(Tuple[int, ...], ())
115
- print(x)
116
- [out]
117
- ()
118
-
119
112
[case testFromFuturePrintFunction_python2]
120
113
from __future__ import print_function
121
114
print('a', 'b')
@@ -162,15 +155,13 @@ _program.py:5: error: Argument 1 to "f" has incompatible type "unicode"; expecte
162
155
_program.py:6: error: Argument 1 to "f" has incompatible type "unicode"; expected "str"
163
156
164
157
[case testStrUnicodeCompatibility_python2]
165
- import typing
166
158
def f(s): # type: (unicode) -> None
167
159
pass
168
160
f(u'')
169
161
f('')
170
162
[out]
171
163
172
164
[case testStrUnicodeCompatibilityInBuiltins_python2]
173
- import typing
174
165
'x'.count('x')
175
166
'x'.count(u'x')
176
167
[out]
@@ -184,16 +175,6 @@ f(tuple())
184
175
[out]
185
176
()
186
177
187
- [case testReadOnlyProperty_python2]
188
- import typing
189
- class A:
190
- @property
191
- def foo(self): # type: () -> int
192
- return 1
193
- print(A().foo + 2)
194
- [out]
195
- 3
196
-
197
178
[case testIOTypes_python2]
198
179
from typing import IO, TextIO, BinaryIO, Any
199
180
class X(IO[str]): pass
@@ -259,19 +240,6 @@ print 'ok'
259
240
[out]
260
241
ok
261
242
262
- [case testUnionType_python2]
263
- from typing import Union
264
- y = None # type: Union[int, str]
265
- def f(x): # type: (Union[int, str]) -> str
266
- if isinstance(x, int):
267
- x = str(x)
268
- return x
269
- print f(12)
270
- print f('ab')
271
- [out]
272
- 12
273
- ab
274
-
275
243
[case testStrAdd_python2]
276
244
import typing
277
245
s = ''
@@ -294,21 +262,13 @@ s = ''.join([u'']) # Error
294
262
_program.py:5: error: Incompatible types in assignment (expression has type "str", variable has type "int")
295
263
_program.py:6: error: Incompatible types in assignment (expression has type "unicode", variable has type "str")
296
264
297
- [case testNamedTuple_python2]
298
- import typing
299
- from collections import namedtuple
300
- X = namedtuple('X', ['a', 'b'])
301
- x = X(a=1, b='s')
302
- print x.a, x.b
303
- [out]
304
- 1 s
305
-
306
265
[case testNamedTupleError_python2]
307
266
import typing
308
267
from collections import namedtuple
309
268
X = namedtuple('X', ['a', 'b'])
310
269
x = X(a=1, b='s')
311
270
x.c
271
+ x.a
312
272
[out]
313
273
_program.py:5: error: "X" has no attribute "c"
314
274
@@ -332,27 +292,6 @@ print 4j / 2.0
332
292
6j
333
293
2j
334
294
335
- [case testNamedTupleWithTypes_python2]
336
- from typing import NamedTuple
337
- N = NamedTuple('N', [('a', int), ('b', str)])
338
- n = N(1, 'x')
339
- print n
340
- a, b = n
341
- print a, b
342
- print n[0]
343
- [out]
344
- N(a=1, b='x')
345
- 1 x
346
- 1
347
-
348
- [case testUnionTypeAlias_python2]
349
- from typing import Union
350
- U = Union[int, str]
351
- u = 1 # type: U
352
- u = 1.1
353
- [out]
354
- _program.py:4: error: Incompatible types in assignment (expression has type "float", variable has type "Union[int, str]")
355
-
356
295
[case testSuperNew_python2]
357
296
from typing import Dict, Any
358
297
class MyType(type):
@@ -365,24 +304,6 @@ print(type(A()).__name__)
365
304
[out]
366
305
Ax
367
306
368
- [case testSequenceIndexAndCount_python2]
369
- from typing import Sequence
370
- def f(x): # type: (Sequence[int]) -> None
371
- print(x.index(1))
372
- print(x.count(1))
373
- f([0, 0, 1, 1, 1])
374
- [out]
375
- 2
376
- 3
377
-
378
- [case testOptional_python2]
379
- from typing import Optional
380
- def f(): # type: () -> Optional[int]
381
- pass
382
- x = f()
383
- y = 1
384
- y = x
385
-
386
307
[case testUnicodeAndOverloading_python2]
387
308
from m import f
388
309
f(1)
0 commit comments