code: def test_local_source_files(app, status, warning):
      def find_source(app, modname):
          if modname == "not_a_package":
              source = (
                  app.srcdir / "not_a_package/__init__.py"
              ).read_text(encoding="utf8")
              tags = {
                  "func1": ("def", 1, 1),
                  "Class1": ("class", 1, 1),
                  "not_a_package.submodule.func1": ("def", 1, 1),
                  "not_a_package.submodule.Class1": ("class", 1, 1),
              }
          else:
              source = (
                  app.srcdir / "not_a_package/submodule.py"
              ).read_text(encoding="utf8")
              tags = {
                  "not_a_package.submodule.func1": ("def", 11, 15),
                  "Class1": ("class", 19, 22),
                  "not_a_package.submodule.Class1": ("class", 19, 22),
                  "Class3": ("class", 25, 30),
                  "not_a_package.submodule.Class3.class_attr": (
                      "other",
                      29,
                      29,
                  ),
              }
          return (source, tags)
  
      app.connect("viewcode-find-source", find_source)
      app.build(force_all=True)
  
      warnings = re.sub(r"\\+", "/", warning.getvalue())
      assert re.findall(
          r"index.rst:\d+: WARNING: Object named 'func1' not found in include "
          + r"file .*/not_a_package/__init__.py'",
          warnings,
      )
  
      result = (app.outdir / "index.html").read_text(encoding="utf8")
      assert (
          result.count('href="_modules/not_a_package.html#func1"') == 1
      )
      assert (
          result.count(
              'href="_modules/not_a_package.html#not_a_package.submodule.func1"'
          )
          == 1
      )
      assert (
          result.count(
              'href="_modules/not_a_package/submodule.html#Class1"'
          )
          == 1
      )
      assert (
          result.count(
              'href="_modules/not_a_package/submodule.html#Class3"'
          )
          == 1
      )
      assert (
          result.count(
              'href="_modules/not_a_package/submodule.html#not_a_package.submodule.Class1"'
          )
          == 1
      )
  
      assert (
          result.count(
              'href="_modules/not_a_package/submodule.html#not_a_package.submodule.Class3.class_attr"'
          )
          == 1
      )
      assert result.count("This is the class attribute class_attr") == 1
  
file_path: sphinx/tests/test_extensions/test_ext_viewcode.py
imports: import re
  import shutil
  import pytest
label_desc: Use image node_id 7 for calling a global function with example usage: test_local_source_files(app, status, warning) and returns: source,  tags