Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for functools.partial #16939

Merged
merged 14 commits into from
May 23, 2024
Prev Previous commit
Next Next commit
fix typeguard
  • Loading branch information
hauntsaninja committed Mar 1, 2024
commit 03b397ec608dadf4dc647675739f7344c9238d60
4 changes: 2 additions & 2 deletions test-data/unit/check-functools.test
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ from typing_extensions import TypeGuard

def is_str_list(val: list[object]) -> TypeGuard[list[str]]: ... # E: "list" is not subscriptable, use "typing.List" instead

# TODO: this isn't correct, but looks like some preexisting handling of TypeGuard inside constraints is broken
functools.partial(is_str_list, [1, 2, 3]) # E: Argument 1 to "partial" has incompatible type "Callable[[List[object]], TypeGuard[List[str]]]"; expected "Callable[..., List[str]]"
reveal_type(functools.partial(is_str_list, [1, 2, 3])) # N: Revealed type is "functools.partial[builtins.bool]"
reveal_type(functools.partial(is_str_list, [1, 2, 3])()) # N: Revealed type is "builtins.bool"
[builtins fixtures/dict.pyi]

[case testFunctoolsPartialType]
Expand Down