Skip to content

assert_type(A, Type[A]): Expression is of type "Type[A]", not "Type[A]" #13623

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

Closed
rsokl opened this issue Sep 7, 2022 · 3 comments
Closed

assert_type(A, Type[A]): Expression is of type "Type[A]", not "Type[A]" #13623

rsokl opened this issue Sep 7, 2022 · 3 comments
Assignees
Labels
assert-type assert_type() bug mypy got something wrong

Comments

@rsokl
Copy link
Contributor

rsokl commented Sep 7, 2022

Bug Report

assert_type(A, Type[A]) raises the error: Expression is of type "Type[A]", not "Type[A]"

To Reproduce

# example.py
from typing import Type
from typing_extensions import assert_type

class A: ...

assert_type(A, Type[A])
$ mypy example.py 
example.py:7: error: Expression is of type "Type[A]", not "Type[A]"
Found 1 error in 1 file (checked 1 source file)

Expected Behavior

I don't think mypy should raise here

Your Environment

  • Mypy version used: mypy 0.971 (compiled: yes)
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.9.13
  • Operating system and version: Windows 11
@rsokl rsokl added the bug mypy got something wrong label Sep 7, 2022
@AlexWaygood AlexWaygood added the assert-type assert_type() label Sep 7, 2022
@AlexWaygood
Copy link
Member

Ew.

@sobolevn
Copy link
Member

sobolevn commented Sep 8, 2022

I can reproduce this on 0.971
But, looks like it is fixed on master, try this on: https://mypy-play.net/?mypy=master&python=3.10

I am going to close this issue, please reopen if this problem remains.
Thanks for the report!

@sobolevn sobolevn closed this as completed Sep 8, 2022
@hauntsaninja
Copy link
Collaborator

I think this was fixed by #13311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert-type assert_type() bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

5 participants