code: def test_mock():
      modname = "sphinx.unknown"
      submodule = modname + ".submodule"
      assert modname not in sys.modules
      with pytest.raises(ImportError):
          import_module(modname)
  
      with mock([modname]):
          import_module(modname)
          assert modname in sys.modules
          assert isinstance(sys.modules[modname], _MockModule)
  
          # submodules are also mocked
          import_module(submodule)
          assert submodule in sys.modules
          assert isinstance(sys.modules[submodule], _MockModule)
  
      assert modname not in sys.modules
      with pytest.raises(ImportError):
          import_module(modname)
  
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 3 for calling a global function with example usage: test_mock() without return types