code: def test_instantiation(tmp_path_factory, rootdir: str, monkeypatch):
      # Given
      src_dir = tmp_path_factory.getbasetemp() / "root"
  
      # special support for sphinx/tests
      if rootdir and not src_dir.exists():
          shutil.copytree(Path(str(rootdir)) / "test-root", src_dir)
  
      syspath = sys.path[:]
  
      # When
      app_ = SphinxTestApp(
          srcdir=src_dir,
          status=StringIO(),
          warning=StringIO(),
      )
      sys.path[:] = syspath
      app_.cleanup()
  
      # Then
      assert isinstance(app_, sphinx.application.Sphinx)
  
file_path: sphinx/tests/test_application.py
imports: import shutil
  import sys
  from io import StringIO
  from pathlib import Path
  from unittest.mock import Mock
  import pytest
  from docutils import nodes
  import sphinx.application
  from sphinx.errors import ExtensionError
  from sphinx.testing.util import SphinxTestApp, strip_escseq
  from sphinx.util import logging
label_desc: Use image node_id 1 for calling a global function with example usage: test_instantiation(tmp_path_factory, rootdir, monkeypatch) without return types