Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ff55dc

Browse files
Add --strict-optional flag to testParamSpecClassConstructor
Co-authored-by: Shantanu <[email protected]>
1 parent 9773e70 commit 5ff55dc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,7 @@ reveal_type(bar(C(fn=foo, x=1))) # N: Revealed type is "__main__.C[[x: builtins
12981298
[builtins fixtures/paramspec.pyi]
12991299

13001300
[case testParamSpecClassConstructor]
1301+
# flags: --strict-optional
13011302
from typing import ParamSpec, Callable
13021303

13031304
P = ParamSpec("P")
@@ -1316,6 +1317,6 @@ def wrong_constructor(a: bool) -> SomeClass:
13161317
return SomeClass("a")
13171318

13181319
func(SomeClass, constructor)
1319-
func(SomeClass, wrong_constructor) # E: Argument 1 to "func" has incompatible type "Type[SomeClass]"; expected "Callable[[VarArg(None), KwArg(None)], SomeClass]" \
1320-
# E: Argument 2 to "func" has incompatible type "Callable[[bool], SomeClass]"; expected "Callable[[VarArg(None), KwArg(None)], SomeClass]"
1320+
func(SomeClass, wrong_constructor) # E: Argument 1 to "func" has incompatible type "Type[SomeClass]"; expected "Callable[[VarArg(<nothing>), KwArg(<nothing>)], SomeClass]" \
1321+
# E: Argument 2 to "func" has incompatible type "Callable[[bool], SomeClass]"; expected "Callable[[VarArg(<nothing>), KwArg(<nothing>)], SomeClass]"
13211322
[builtins fixtures/paramspec.pyi]

0 commit comments

Comments
 (0)