Skip to content

Commit c8204ed

Browse files
committed
Remove an non-conformant old test, move the problematic part of it to testParamSpecLocations
1 parent caeb13e commit c8204ed

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

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

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ P5 = ParamSpec("P5", covariant=True, bound=int) # E: The variance and bound arg
1414
[builtins fixtures/paramspec.pyi]
1515

1616
[case testParamSpecLocations]
17-
from typing import Any, Callable, List
17+
from typing import Any, Callable, List, Type
1818
from typing_extensions import ParamSpec, Concatenate
1919
P = ParamSpec('P')
2020

@@ -37,6 +37,11 @@ def foo5(x: Callable[[int, str], P]) -> None: ... # E: Invalid location for Par
3737
def foo6(x: Callable[[P], int]) -> None: ... # E: Invalid location for ParamSpec "P" \
3838
# N: You can use ParamSpec as the first argument to Callable, e.g., "Callable[P, int]"
3939

40+
def foo7(
41+
*args: P.args, **kwargs: P.kwargs # E: ParamSpec "P" is unbound
42+
) -> Callable[[Callable[P, T]], Type[T]]:
43+
...
44+
4045
def wrapper(f: Callable[P, int]) -> None:
4146
def inner(*args: P.args, **kwargs: P.kwargs) -> None: ... # OK
4247

@@ -2158,28 +2163,6 @@ submit(
21582163
)
21592164
[builtins fixtures/paramspec.pyi]
21602165

2161-
[case testParamSpecGenericWithNamedArg2]
2162-
from typing import Callable, TypeVar, Type
2163-
from typing_extensions import ParamSpec
2164-
2165-
P= ParamSpec("P")
2166-
T = TypeVar("T")
2167-
2168-
def smoke_testable(*args: P.args, **kwargs: P.kwargs) -> Callable[[Callable[P, T]], Type[T]]: # E: ParamSpec "P" is unbound
2169-
...
2170-
2171-
@smoke_testable(name="bob", size=512, flt=0.5)
2172-
class SomeClass:
2173-
def __init__(self, size: int, name: str, flt: float) -> None:
2174-
pass
2175-
2176-
# Error message is confusing, but this is a known issue, see #4530.
2177-
@smoke_testable(name=42, size="bad", flt=0.5)
2178-
class OtherClass:
2179-
def __init__(self, size: int, name: str, flt: float) -> None:
2180-
pass
2181-
[builtins fixtures/paramspec.pyi]
2182-
21832166
[case testInferenceAgainstGenericCallableUnionParamSpec]
21842167
from typing import Callable, TypeVar, List, Union
21852168
from typing_extensions import ParamSpec

0 commit comments

Comments
 (0)