You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The probable reason NonCallableMock (and the other mock classes) were defined like this is so that they can be passed in place as any other object without type checkers complaining. I think I remember some discussion about it where it was suggested that the mock classes should derive from Any instead, something like this:
classNonCallableMock(Base, Any):
def__getattr__(self, name: str) ->Any: ...
# other methods go here
I quickly tried this, and it seems to work fine with mypy. I think this is worth a go.
Activity
srittau commentedon Mar 12, 2020
The probable reason
NonCallableMock(and the other mock classes) were defined like this is so that they can be passed in place as any other object without type checkers complaining. I think I remember some discussion about it where it was suggested that the mock classes should derive fromAnyinstead, something like this:I quickly tried this, and it seems to work fine with mypy. I think this is worth a go.
rodrigondec commentedon Mar 12, 2020
@srittau Assign this to me plz