mypy icon indicating copy to clipboard operation
mypy copied to clipboard

`[type-abstract]` reports with a `tuple` when the actual type is a `dict`

Open bzoracler opened this issue 1 year ago • 0 comments

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

bzoracler avatar Jun 18 '24 00:06 bzoracler