From 35db0b1963151ac467c25ad5bd056a876e24d784 Mon Sep 17 00:00:00 2001 From: David Fisher Date: Thu, 19 Jan 2017 14:53:31 -0800 Subject: [PATCH 1/4] Fixup check-expressions --- mypy/test/testcheck.py | 2 +- test-data/unit/check-expressions.test | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mypy/test/testcheck.py b/mypy/test/testcheck.py index e12004ba9142..f81140c96b15 100644 --- a/mypy/test/testcheck.py +++ b/mypy/test/testcheck.py @@ -27,7 +27,6 @@ # List of files that contain test case descriptions. files = [ - 'check-expressions.test', 'check-generic-subtyping.test', 'check-varargs.test', ] @@ -73,6 +72,7 @@ 'check-columns.test', 'check-functions.test', 'check-tuples.test', + 'check-expressions.test', ] files.extend(fast_parser_files) diff --git a/test-data/unit/check-expressions.test b/test-data/unit/check-expressions.test index 8b103f62cd78..574c8c379bd8 100644 --- a/test-data/unit/check-expressions.test +++ b/test-data/unit/check-expressions.test @@ -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 @@ -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] From 642bf8f0e120b0fe664bf58047751ed3158691e1 Mon Sep 17 00:00:00 2001 From: David Fisher Date: Thu, 19 Jan 2017 15:09:41 -0800 Subject: [PATCH 2/4] Fixup check-generic-subtyping --- mypy/test/testcheck.py | 2 +- test-data/unit/check-generic-subtyping.test | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/mypy/test/testcheck.py b/mypy/test/testcheck.py index f81140c96b15..fd3458ffc7de 100644 --- a/mypy/test/testcheck.py +++ b/mypy/test/testcheck.py @@ -27,7 +27,6 @@ # List of files that contain test case descriptions. files = [ - 'check-generic-subtyping.test', 'check-varargs.test', ] fast_parser_files = [ @@ -73,6 +72,7 @@ 'check-functions.test', 'check-tuples.test', 'check-expressions.test', + 'check-generic-subtyping.test', ] files.extend(fast_parser_files) diff --git a/test-data/unit/check-generic-subtyping.test b/test-data/unit/check-generic-subtyping.test index 46df3c9b8cdd..35cd0f99a4cc 100644 --- a/test-data/unit/check-generic-subtyping.test +++ b/test-data/unit/check-generic-subtyping.test @@ -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 @@ -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 @@ -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 @@ -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] From 870204df516341cfb64b1fb38056e9d75bef42d4 Mon Sep 17 00:00:00 2001 From: David Fisher Date: Thu, 19 Jan 2017 16:23:14 -0800 Subject: [PATCH 3/4] Switch check-newsyntax and check-underscores to fast parser --- mypy/test/testcheck.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mypy/test/testcheck.py b/mypy/test/testcheck.py index fd3458ffc7de..054c11c99213 100644 --- a/mypy/test/testcheck.py +++ b/mypy/test/testcheck.py @@ -78,10 +78,10 @@ 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): From eb623510671161478a775c3b6729abafbf0a6438 Mon Sep 17 00:00:00 2001 From: David Fisher Date: Fri, 20 Jan 2017 15:57:28 -0800 Subject: [PATCH 4/4] Skip some known-bug tests in check-varargs --- mypy/test/testcheck.py | 2 +- test-data/unit/check-varargs.test | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mypy/test/testcheck.py b/mypy/test/testcheck.py index 054c11c99213..6f3b1561474a 100644 --- a/mypy/test/testcheck.py +++ b/mypy/test/testcheck.py @@ -27,7 +27,6 @@ # List of files that contain test case descriptions. files = [ - 'check-varargs.test', ] fast_parser_files = [ 'check-basic.test', @@ -73,6 +72,7 @@ 'check-tuples.test', 'check-expressions.test', 'check-generic-subtyping.test', + 'check-varargs.test', ] files.extend(fast_parser_files) diff --git a/test-data/unit/check-varargs.test b/test-data/unit/check-varargs.test index 89120bffe153..8187ea780519 100644 --- a/test-data/unit/check-varargs.test +++ b/test-data/unit/check-varargs.test @@ -381,7 +381,8 @@ 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 def f(x: int, y: str) -> None: pass f(x=1, *[2]) [builtins fixtures/list.pyi] @@ -389,7 +390,8 @@ f(x=1, *[2]) 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]