code: def test_MockObject():
      mock = _MockObject()
      assert isinstance(mock.some_attr, _MockObject)
      assert isinstance(mock.some_method, _MockObject)
      assert isinstance(mock.attr1.attr2, _MockObject)
      assert isinstance(mock.attr1.attr2.meth(), _MockObject)
  
      # subclassing
      class SubClass(mock.SomeClass):
          """docstring of SubClass"""
  
          def method(self):
              return "string"
  
      obj = SubClass()
      assert SubClass.__doc__ == "docstring of SubClass"
      assert isinstance(obj, SubClass)
      assert obj.method() == "string"
      assert isinstance(obj.other_method(), SubClass)
  
      # parametrized type
      T = TypeVar("T")
  
      class SubClass2(mock.SomeClass[T]):
          """docstring of SubClass"""
  
      obj2 = SubClass2()
      assert SubClass2.__doc__ == "docstring of SubClass"
      assert isinstance(obj2, SubClass2)
  
file_path: sphinx/tests/test_extensions/test_ext_autodoc_mock.py
imports: from __future__ import annotations
  import abc
  import sys
  from importlib import import_module
  from typing import TypeVar
  import pytest
  from sphinx.ext.autodoc.mock import _MockModule, _MockObject, ismock, mock, undecorate
label_desc: Use image node_id 2 for calling a global function with example usage: test_MockObject() and returns: str