@@ -109,13 +109,6 @@ f(re.match('x*', 'xxy'))
109109[out]
110110xx
111111
112- [case testVariableLengthTuple_python2]
113- from typing import Tuple, cast
114- x = cast(Tuple[int, ...], ())
115- print(x)
116- [out]
117- ()
118-
119112[case testFromFuturePrintFunction_python2]
120113from __future__ import print_function
121114print('a', 'b')
@@ -162,15 +155,13 @@ _program.py:5: error: Argument 1 to "f" has incompatible type "unicode"; expecte
162155_program.py:6: error: Argument 1 to "f" has incompatible type "unicode"; expected "str"
163156
164157[case testStrUnicodeCompatibility_python2]
165- import typing
166158def f(s): # type: (unicode) -> None
167159 pass
168160f(u'')
169161f('')
170162[out]
171163
172164[case testStrUnicodeCompatibilityInBuiltins_python2]
173- import typing
174165'x'.count('x')
175166'x'.count(u'x')
176167[out]
@@ -184,16 +175,6 @@ f(tuple())
184175[out]
185176()
186177
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-
197178[case testIOTypes_python2]
198179from typing import IO, TextIO, BinaryIO, Any
199180class X(IO[str]): pass
@@ -259,19 +240,6 @@ print 'ok'
259240[out]
260241ok
261242
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-
275243[case testStrAdd_python2]
276244import typing
277245s = ''
@@ -294,21 +262,13 @@ s = ''.join([u'']) # Error
294262_program.py:5: error: Incompatible types in assignment (expression has type "str", variable has type "int")
295263_program.py:6: error: Incompatible types in assignment (expression has type "unicode", variable has type "str")
296264
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-
306265[case testNamedTupleError_python2]
307266import typing
308267from collections import namedtuple
309268X = namedtuple('X', ['a', 'b'])
310269x = X(a=1, b='s')
311270x.c
271+ x.a
312272[out]
313273_program.py:5: error: "X" has no attribute "c"
314274
@@ -332,27 +292,6 @@ print 4j / 2.0
3322926j
3332932j
334294
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-
356295[case testSuperNew_python2]
357296from typing import Dict, Any
358297class MyType(type):
@@ -365,24 +304,6 @@ print(type(A()).__name__)
365304[out]
366305Ax
367306
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-
386307[case testUnicodeAndOverloading_python2]
387308from m import f
388309f(1)
0 commit comments