code: def test_images(app):
      app.build()
  
      tree = app.env.get_doctree("images")
      htmlbuilder = StandaloneHTMLBuilder(app, app.env)
      htmlbuilder.init()
      htmlbuilder.imgpath = "dummy"
      htmlbuilder.post_process_images(tree)
      assert set(htmlbuilder.images.keys()) == {
          "subdir/img.png",
          "img.png",
          "subdir/simg.png",
          "svgimg.svg",
          "img.foo.png",
      }
      assert set(htmlbuilder.images.values()) == {
          "img.png",
          "img1.png",
          "simg.png",
          "svgimg.svg",
          "img.foo.png",
      }
  
      latexbuilder = LaTeXBuilder(app, app.env)
      latexbuilder.init()
      latexbuilder.post_process_images(tree)
      assert set(latexbuilder.images.keys()) == {
          "subdir/img.png",
          "subdir/simg.png",
          "img.png",
          "img.pdf",
          "svgimg.pdf",
          "img.foo.png",
      }
      assert set(latexbuilder.images.values()) == {
          "img.pdf",
          "img.png",
          "img1.png",
          "simg.png",
          "svgimg.pdf",
          "img.foo.png",
      }
  
file_path: sphinx/tests/test_environment/test_environment.py
imports: import os
  import shutil
  from pathlib import Path
  import pytest
  from sphinx.builders.html import StandaloneHTMLBuilder
  from sphinx.builders.latex import LaTeXBuilder
  from sphinx.environment import CONFIG_CHANGED, CONFIG_EXTENSIONS_CHANGED, CONFIG_NEW, CONFIG_OK
label_desc: Use image node_id 2 for calling a global function with example usage: test_images(app) without return types