mypy
mypy copied to clipboard
`[type-abstract]` reports with a `tuple` when the actual type is a `dict`
Bug Report, To Reproduce, & Actual Behaviour
See mypy Playground
from abc import ABC, abstractmethod
class Abstract(ABC):
@abstractmethod
def method(self) -> None: ...
class Unimplemented(Abstract): ...
class Parent:
others: dict[str, type[Abstract]]
class Child(Parent):
others = {"abstract": Unimplemented} # E: Only concrete class can be given where "tuple[str, type[Abstract]]" is expected [type-abstract]
Expected Behavior
Reports the error message with "dict[str, type[Abstract]]".
Your Environment
- Mypy version used: 1.10
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini(and other config files): None - Python version used: 3.10, 3.12