Skip to content

Fix remaining testcheck tests for fast parser #2730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions mypy/test/testcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@

# List of files that contain test case descriptions.
files = [
'check-expressions.test',
'check-generic-subtyping.test',
'check-varargs.test',
]
fast_parser_files = [
'check-basic.test',
Expand Down Expand Up @@ -73,15 +70,18 @@
'check-columns.test',
'check-functions.test',
'check-tuples.test',
'check-expressions.test',
'check-generic-subtyping.test',
'check-varargs.test',
]

files.extend(fast_parser_files)

if 'annotation' in typed_ast.ast35.Assign._fields:
files.append('check-newsyntax.test')
fast_parser_files.append('check-newsyntax.test')

if 'contains_underscores' in typed_ast.ast35.Num._fields:
files.append('check-underscores.test')
fast_parser_files.append('check-underscores.test')


class TypeCheckSuite(DataSuite):
Expand Down
8 changes: 4 additions & 4 deletions test-data/unit/check-expressions.test
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,6 @@ main:6: error: "f" does not return a value

[case testNoneReturnTypeWithStatements]
import typing
raise f() # Fail
if f(): # Fail
pass
elif f(): # Fail
Expand All @@ -904,14 +903,15 @@ while f(): # Fail
pass
def g() -> object:
return f() # Fail
raise f() # Fail

def f() -> None: pass
[builtins fixtures/exception.pyi]
[out]
main:2: error: "f" does not return a value
main:3: error: "f" does not return a value
main:5: error: "f" does not return a value
main:7: error: "f" does not return a value
main:4: error: "f" does not return a value
main:6: error: "f" does not return a value
main:9: error: "f" does not return a value
main:10: error: "f" does not return a value

[case testNoneReturnTypeWithExpressions]
Expand Down
9 changes: 3 additions & 6 deletions test-data/unit/check-generic-subtyping.test
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,6 @@ s, s = Nums() # E: Incompatible types in assignment (expression has type "int",

[case testCovariant]
from typing import TypeVar, Generic
True = 1

T = TypeVar('T', covariant=True)

class G(Generic[T]): pass
Expand All @@ -708,12 +706,11 @@ c = None # type: G[C]

b = a # E: Incompatible types in assignment (expression has type G[A], variable has type G[B])
b = c
[builtins fixtures/bool.pyi]
[out]

[case testContravariant]
from typing import TypeVar, Generic
True = 1

T = TypeVar('T', contravariant=True)

class G(Generic[T]): pass
Expand All @@ -727,12 +724,11 @@ c = None # type: G[C]

b = a
b = c # E: Incompatible types in assignment (expression has type G[C], variable has type G[B])
[builtins fixtures/bool.pyi]
[out]

[case testInvariant]
from typing import TypeVar, Generic
True = 1

T = TypeVar('T') # invariant (default)

class G(Generic[T]): pass
Expand All @@ -746,4 +742,5 @@ c = None # type: G[C]

b = a # E: Incompatible types in assignment (expression has type G[A], variable has type G[B])
b = c # E: Incompatible types in assignment (expression has type G[C], variable has type G[B])
[builtins fixtures/bool.pyi]
[out]
6 changes: 4 additions & 2 deletions test-data/unit/check-varargs.test
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,17 @@ main:4: error: Argument 2 to "f" has incompatible type *List[A]; expected "B"
main:5: error: Argument 3 to "f" has incompatible type *List[A]; expected "B"
main:6: error: Argument 1 to "f" has incompatible type *"Tuple[A, A, B]"; expected "B"

[case testVarArgsAfterKeywordArgInCall1]
[case testVarArgsAfterKeywordArgInCall1-skip]
# see: mypy issue #2729
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused, that issue claims to be about Python 2, but this test (or the next) is not about Python 2 IIUC. What am I missing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments on issue. I was wrong about it being a Python 2-specific problem.

def f(x: int, y: str) -> None: pass
f(x=1, *[2])
[builtins fixtures/list.pyi]
[out]
main:2: error: "f" gets multiple values for keyword argument "x"
main:2: error: Argument 2 to "f" has incompatible type *List[int]; expected "str"

[case testVarArgsAfterKeywordArgInCall2]
[case testVarArgsAfterKeywordArgInCall2-skip]
# see: mypy issue #2729
def f(x: int, y: str) -> None: pass
f(y='x', *[1])
[builtins fixtures/list.pyi]
Expand Down