-
Notifications
You must be signed in to change notification settings - Fork 227
Closed
astral-sh/ruff
#20842Labels
bugSomething isn't workingSomething isn't workingcallsIssues relating to call-signature checking and diagnosticsIssues relating to call-signature checking and diagnostics
Description
Assignability, subtyping, and maybe also equivalence are currently too strict for function-like callables. For example, it should be possible to assign Mock() to a function-like callable, but we currently get:
from dataclasses import dataclass
from unittest.mock import Mock
@dataclass(order=True)
class Data:
value: int
def test_t():
d = Data(1)
# error: Object of type `Mock` is not assignable to
# attribute `__lt__` of type `(self: Data, other: Data) -> bool`
d.__lt__ = Mock()Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcallsIssues relating to call-signature checking and diagnosticsIssues relating to call-signature checking and diagnostics