Skip to content

Commit 89f8350

Browse files
split Callback test into two.
1 parent ab1e450 commit 89f8350

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

test-data/unit/check-python310.test

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ def test_object(x: object) -> None:
10771077
case Callable() as fn:
10781078
reveal_type(fn) # N: Revealed type is "def (*Any, **Any) -> Any"
10791079

1080-
def test_intfun(x: Callable[[int], int]) -> None:
1080+
def test_impl(x: Callable[[int], int]) -> None:
10811081
match x:
10821082
case Callable() as fn:
10831083
reveal_type(fn) # N: Revealed type is "def (builtins.int) -> builtins.int"
@@ -1087,6 +1087,26 @@ def test_intfun(x: Callable[[int], int]) -> None:
10871087
from typing import Any, Callable
10881088
from typing_extensions import Protocol, runtime_checkable
10891089

1090+
@runtime_checkable
1091+
class FnProto(Protocol):
1092+
def __call__(self, x: int, /) -> object: ...
1093+
1094+
def test_object(x: object) -> None:
1095+
match x:
1096+
case FnProto() as fn:
1097+
reveal_type(fn) # N: Revealed type is "__main__.FnProto"
1098+
1099+
def test_impl(x: Callable[[int], int]) -> None:
1100+
match x:
1101+
case FnProto() as fn:
1102+
reveal_type(fn) # N: Revealed type is "def (builtins.int) -> builtins.int"
1103+
1104+
[builtins fixtures/dict.pyi]
1105+
1106+
[case testMatchClassPatternAnyCallableProtocol]
1107+
from typing import Any, Callable
1108+
from typing_extensions import Protocol, runtime_checkable
1109+
10901110
@runtime_checkable
10911111
class AnyCallable(Protocol):
10921112
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
@@ -1096,7 +1116,7 @@ def test_object(x: object) -> None:
10961116
case AnyCallable() as fn:
10971117
reveal_type(fn) # N: Revealed type is "__main__.AnyCallable"
10981118

1099-
def test_intfun(x: Callable[[int], int]) -> None:
1119+
def test_impl(x: Callable[[int], int]) -> None:
11001120
match x:
11011121
case AnyCallable() as fn:
11021122
reveal_type(fn) # N: Revealed type is "def (builtins.int) -> builtins.int"

0 commit comments

Comments
 (0)