PyDocs

Nav

Development Tools

Mock.__class__

unittest.mock

attribute of Mock (source)
Normally the __class__ attribute of an object will return its type. For a mock object with a spec, __class__ returns the spec class instead. This allows mock objects to pass isinstance() tests for the object they are replacing / masquerading as:
1 Example
>>> mock = Mock()
>>> mock.__class__ = dict
>>> isinstance(mock, dict)
True
from the Python docs
See Also
No see-alsos for unittest.mock/Mock.__class__
0 Notes
No notes for Mock.__class__