Skip to content

Commit 536a48b

Browse files
JukkaLgvanrossum
authored andcommitted
Clean up test fixtures (#3485)
1 parent e102c6a commit 536a48b

File tree

7 files changed

+15
-14
lines changed

7 files changed

+15
-14
lines changed

test-data/unit/check-classes.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ main:4: error: Invalid signature "def (__main__.B, __main__.A) -> __main__.B"
16651665
main:6: error: Invalid signature "def (__main__.C, builtins.str, builtins.str) -> __main__.C"
16661666

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

@@ -1729,6 +1729,7 @@ c = C()
17291729
c.check = 13
17301730

17311731
[case testGetAttrAndSetattr]
1732+
from typing import Any
17321733
class A:
17331734
def __setattr__(self, name: str, value: Any) -> None: ...
17341735
def __getattr__(self, name: str) -> Any: ...

test-data/unit/check-functions.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def r(x) -> None: ...
8888
r = l # E: Incompatible types in assignment (expression has type Callable[[Any, Any], None], variable has type Callable[[Any], None])
8989

9090
[case testSubtypingFunctionsImplicitNames]
91+
from typing import Any
9192

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

18261827

18271828
[case testRedefineFunction]
1829+
from typing import Any
18281830
def f(x) -> Any: pass
18291831
def g(x, y): pass
18301832
def h(x): pass

test-data/unit/check-unions.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,13 @@ t_a = None # type: Type[Any]
335335
reveal_type(u(t_o, t_o)) # E: Revealed type is 'Type[builtins.object]'
336336
reveal_type(u(t_s, t_s)) # E: Revealed type is 'Type[builtins.str]'
337337
reveal_type(u(t_a, t_a)) # E: Revealed type is 'Type[Any]'
338-
reveal_type(u(type, type)) # E: Revealed type is 'def (x: Any) -> builtins.type'
338+
reveal_type(u(type, type)) # E: Revealed type is 'def (x: builtins.object) -> builtins.type'
339339

340340
# One type, other non-type
341341
reveal_type(u(t_s, 1)) # E: Revealed type is 'Union[builtins.int*, Type[builtins.str]]'
342342
reveal_type(u(1, t_s)) # E: Revealed type is 'Union[Type[builtins.str], builtins.int*]'
343-
reveal_type(u(type, 1)) # E: Revealed type is 'Union[builtins.int*, def (x: Any) -> builtins.type]'
344-
reveal_type(u(1, type)) # E: Revealed type is 'Union[def (x: Any) -> builtins.type, builtins.int*]'
343+
reveal_type(u(type, 1)) # E: Revealed type is 'Union[builtins.int*, def (x: builtins.object) -> builtins.type]'
344+
reveal_type(u(1, type)) # E: Revealed type is 'Union[def (x: builtins.object) -> builtins.type, builtins.int*]'
345345
reveal_type(u(t_a, 1)) # E: Revealed type is 'Union[builtins.int*, Type[Any]]'
346346
reveal_type(u(1, t_a)) # E: Revealed type is 'Union[Type[Any], builtins.int*]'
347347
reveal_type(u(t_o, 1)) # E: Revealed type is 'Union[builtins.int*, Type[builtins.object]]'

test-data/unit/lib-stub/builtins.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
Any = 0
2-
31
class object:
42
def __init__(self) -> None: pass
53

64
class type:
7-
def __init__(self, x: Any) -> None: pass
5+
def __init__(self, x: object) -> None: pass
86

97
# These are provided here for convenience.
108
class int:

test-data/unit/lib-stub/types.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from typing import TypeVar, Optional, List, Any, Generic, Sequence
2-
T = TypeVar('T')
1+
from typing import TypeVar
32

4-
def coroutine(func: T) -> T:
5-
return func
3+
_T = TypeVar('_T')
4+
5+
def coroutine(func: _T) -> _T: pass
66

77
class bool: ...
88

test-data/unit/semanal-classvar.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def f(x: ClassVar, y: ClassVar) -> ClassVar: pass
9595
main:2: error: ClassVar can only be used for assignments in class body
9696

9797
[case testClassVarInCallableArgs]
98-
from typing import Callable, ClassVar
98+
from typing import Callable, ClassVar, Any
9999
f = None # type: Callable[[int, ClassVar], Any]
100100
[out]
101101
main:2: error: Invalid type: ClassVar nested inside other type

test-data/unit/semanal-types.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ MypyFile:1(
720720
def ()))
721721

722722
[case testOverloadedFunction]
723-
from typing import overload
723+
from typing import overload, Any
724724
@overload
725725
def f(a: object) -> int: a
726726
@overload
@@ -730,7 +730,7 @@ def f(a: Any) -> Any: return a
730730

731731
[out]
732732
MypyFile:1(
733-
ImportFrom:1(typing, [overload])
733+
ImportFrom:1(typing, [overload, Any])
734734
OverloadedFuncDef:2(
735735
FuncDef:7(
736736
f

0 commit comments

Comments
 (0)