-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
assert-typeassert_type()assert_type()bugmypy got something wrongmypy got something wrongtopic-usability
Description
Bug Report
'assert_type()' refuses to match a function to its own type.
To Reproduce
from typing import assert_type, Callable
def myfunc(arg: int) -> None: pass
assert_type(myfunc, Callable[[int], None])
# Gist URL: https://gist.github.com/mypy-play/50dde8e891d971d823c4c6af2e639834
# Playground URL: https://mypy-play.net/?mypy=latest&python=3.11&gist=50dde8e891d971d823c4c6af2e639834
Expected Behavior
No error.
Actual Behavior
main.py:5: error: Expression is of type "Callable[[int], None]", not "Callable[[int], None]" [assert-type]
Found 1 error in 1 file (checked 1 source file)
The error disappears if the function takes no arguments.
Your Environment
- Mypy version used: both 1.2.0 and current master branch (commit 29cc561)
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini
(and other config files): default - Python version used: 3.11
Metadata
Metadata
Assignees
Labels
assert-typeassert_type()assert_type()bugmypy got something wrongmypy got something wrongtopic-usability