code: def test_theme_api(app, status, warning):
      cfg = app.config
  
      themes = [
          "basic",
          "default",
          "scrolls",
          "agogo",
          "sphinxdoc",
          "haiku",
          "traditional",
          "epub",
          "nature",
          "pyramid",
          "bizstyle",
          "classic",
          "nonav",
          "test-theme",
          "ziptheme",
          "staticfiles",
          "parent",
          "child",
          "alabaster",
      ]
  
      # test Theme class API
      assert set(app.registry.html_themes.keys()) == set(themes)
      assert app.registry.html_themes["test-theme"] == str(
          app.srcdir / "test_theme" / "test-theme"
      )
      assert app.registry.html_themes["ziptheme"] == str(
          app.srcdir / "ziptheme.zip"
      )
      assert app.registry.html_themes["staticfiles"] == str(
          app.srcdir / "test_theme" / "staticfiles"
      )
  
      # test Theme instance API
      theme = app.builder.theme
      assert theme.name == "ziptheme"
      themedir = theme.themedir
      assert theme.base.name == "basic"
      assert len(theme.get_theme_dirs()) == 2
  
      # direct setting
      assert theme.get_config("theme", "stylesheet") == "custom.css"
      # inherited setting
      assert theme.get_config("options", "nosidebar") == "false"
      # nonexisting setting
      assert theme.get_config("theme", "foobar", "def") == "def"
      with pytest.raises(ThemeError):
          theme.get_config("theme", "foobar")
  
      # options API
  
      options = theme.get_options({"nonexisting": "foo"})
      assert "nonexisting" not in options
  
      options = theme.get_options(cfg.html_theme_options)
      assert options["testopt"] == "foo"
      assert options["nosidebar"] == "false"
  
      # cleanup temp directories
      theme.cleanup()
      assert not os.path.exists(themedir)
  
file_path: sphinx/tests/test_theming/test_theming.py
imports: import os
  import pytest
  import sphinx.builders.html
  from sphinx.theming import Theme, ThemeError
label_desc: Use image node_id 1 for calling a global function with example usage: test_theme_api(app, status, warning) without return types