Skip to content

Commit bba51e0

Browse files
authored
Remove some low-value, slow tests (#4874)
The removed tests use real stubs and/or run Python and thus are pretty slow to run. Most of them either test stubs in straightforward ways (which is not very useful, since the coverage is bound to be spotty) or some very basic functionality (which is covered by other tests). The removals speed up the Python evaluation suite by about 25% on my laptop (there is a high variance, though). There are probably others that could safely be removed but I tried to be pretty conservative here.
1 parent f30f676 commit bba51e0

File tree

2 files changed

+3
-392
lines changed

2 files changed

+3
-392
lines changed

test-data/unit/python2eval.test

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,6 @@ f(re.match('x*', 'xxy'))
109109
[out]
110110
xx
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]
120113
from __future__ import print_function
121114
print('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
166158
def f(s): # type: (unicode) -> None
167159
pass
168160
f(u'')
169161
f('')
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]
198179
from typing import IO, TextIO, BinaryIO, Any
199180
class X(IO[str]): pass
@@ -259,19 +240,6 @@ print 'ok'
259240
[out]
260241
ok
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]
276244
import typing
277245
s = ''
@@ -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]
307266
import typing
308267
from collections import namedtuple
309268
X = namedtuple('X', ['a', 'b'])
310269
x = X(a=1, b='s')
311270
x.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
332292
6j
333293
2j
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]
357296
from typing import Dict, Any
358297
class MyType(type):
@@ -365,24 +304,6 @@ print(type(A()).__name__)
365304
[out]
366305
Ax
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]
387308
from m import f
388309
f(1)

0 commit comments

Comments
 (0)