Skip to content

Clean up test fixtures #3485

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 2 commits into from
Jun 2, 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
3 changes: 2 additions & 1 deletion test-data/unit/check-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ main:4: error: Invalid signature "def (__main__.B, __main__.A) -> __main__.B"
main:6: error: Invalid signature "def (__main__.C, builtins.str, builtins.str) -> __main__.C"

[case testSetAttr]
from typing import Union
from typing import Union, Any
class A:
def __setattr__(self, name: str, value: Any) -> None: ...

Expand Down Expand Up @@ -1729,6 +1729,7 @@ c = C()
c.check = 13

[case testGetAttrAndSetattr]
from typing import Any
class A:
def __setattr__(self, name: str, value: Any) -> None: ...
def __getattr__(self, name: str) -> Any: ...
Expand Down
2 changes: 2 additions & 0 deletions test-data/unit/check-functions.test
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def r(x) -> None: ...
r = l # E: Incompatible types in assignment (expression has type Callable[[Any, Any], None], variable has type Callable[[Any], None])

[case testSubtypingFunctionsImplicitNames]
from typing import Any

def f(a, b): pass
def g(c: Any, d: Any) -> Any: pass
Expand Down Expand Up @@ -1825,6 +1826,7 @@ class A(Generic[t]):


[case testRedefineFunction]
from typing import Any
def f(x) -> Any: pass
def g(x, y): pass
def h(x): pass
Expand Down
6 changes: 3 additions & 3 deletions test-data/unit/check-unions.test
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,13 @@ t_a = None # type: Type[Any]
reveal_type(u(t_o, t_o)) # E: Revealed type is 'Type[builtins.object]'
reveal_type(u(t_s, t_s)) # E: Revealed type is 'Type[builtins.str]'
reveal_type(u(t_a, t_a)) # E: Revealed type is 'Type[Any]'
reveal_type(u(type, type)) # E: Revealed type is 'def (x: Any) -> builtins.type'
reveal_type(u(type, type)) # E: Revealed type is 'def (x: builtins.object) -> builtins.type'

# One type, other non-type
reveal_type(u(t_s, 1)) # E: Revealed type is 'Union[builtins.int*, Type[builtins.str]]'
reveal_type(u(1, t_s)) # E: Revealed type is 'Union[Type[builtins.str], builtins.int*]'
reveal_type(u(type, 1)) # E: Revealed type is 'Union[builtins.int*, def (x: Any) -> builtins.type]'
reveal_type(u(1, type)) # E: Revealed type is 'Union[def (x: Any) -> builtins.type, builtins.int*]'
reveal_type(u(type, 1)) # E: Revealed type is 'Union[builtins.int*, def (x: builtins.object) -> builtins.type]'
reveal_type(u(1, type)) # E: Revealed type is 'Union[def (x: builtins.object) -> builtins.type, builtins.int*]'
reveal_type(u(t_a, 1)) # E: Revealed type is 'Union[builtins.int*, Type[Any]]'
reveal_type(u(1, t_a)) # E: Revealed type is 'Union[Type[Any], builtins.int*]'
reveal_type(u(t_o, 1)) # E: Revealed type is 'Union[builtins.int*, Type[builtins.object]]'
Expand Down
4 changes: 1 addition & 3 deletions test-data/unit/lib-stub/builtins.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
Any = 0

class object:
def __init__(self) -> None: pass

class type:
def __init__(self, x: Any) -> None: pass
def __init__(self, x: object) -> None: pass

# These are provided here for convenience.
class int:
Expand Down
8 changes: 4 additions & 4 deletions test-data/unit/lib-stub/types.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import TypeVar, Optional, List, Any, Generic, Sequence
T = TypeVar('T')
from typing import TypeVar

def coroutine(func: T) -> T:
return func
_T = TypeVar('_T')

def coroutine(func: _T) -> _T: pass

class bool: ...

Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/semanal-classvar.test
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def f(x: ClassVar, y: ClassVar) -> ClassVar: pass
main:2: error: ClassVar can only be used for assignments in class body

[case testClassVarInCallableArgs]
from typing import Callable, ClassVar
from typing import Callable, ClassVar, Any
f = None # type: Callable[[int, ClassVar], Any]
[out]
main:2: error: Invalid type: ClassVar nested inside other type
Expand Down
4 changes: 2 additions & 2 deletions test-data/unit/semanal-types.test
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ MypyFile:1(
def ()))

[case testOverloadedFunction]
from typing import overload
from typing import overload, Any
@overload
def f(a: object) -> int: a
@overload
Expand All @@ -730,7 +730,7 @@ def f(a: Any) -> Any: return a

[out]
MypyFile:1(
ImportFrom:1(typing, [overload])
ImportFrom:1(typing, [overload, Any])
OverloadedFuncDef:2(
FuncDef:7(
f
Expand Down