Skip to content

Commit 6a24e1d

Browse files
authored
Add tests for decorating ParamSpec (python#12555)
1 parent 965c6c9 commit 6a24e1d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test-data/unit/check-parameter-specification.test

+23
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,29 @@ a3 = f2
997997
a3 = f1
998998
[builtins fixtures/tuple.pyi]
999999

1000+
[case testDecoratingClassesThatUseParamSpec]
1001+
from typing import Generic, TypeVar, Callable, Any
1002+
from typing_extensions import ParamSpec
1003+
1004+
_P = ParamSpec("_P")
1005+
_T = TypeVar("_T")
1006+
_F = TypeVar("_F", bound=Callable[..., Any])
1007+
1008+
def f(x: _F) -> _F: ...
1009+
1010+
@f # Should be ok
1011+
class OnlyParamSpec(Generic[_P]):
1012+
pass
1013+
1014+
@f # Should be ok
1015+
class MixedWithTypeVar1(Generic[_P, _T]):
1016+
pass
1017+
1018+
@f # Should be ok
1019+
class MixedWithTypeVar2(Generic[_T, _P]):
1020+
pass
1021+
[builtins fixtures/dict.pyi]
1022+
10001023
[case testGenericsInInferredParamspec]
10011024
from typing import Callable, TypeVar, Generic
10021025
from typing_extensions import ParamSpec

0 commit comments

Comments
 (0)