code: def test_toc_all_references_should_exist_pep420_disabled(
      make_app, apidoc
  ):
      """All references in toc should exist. This test doesn't say if
      directories with empty __init__.py and and nothing else should be
      skipped, just ensures consistency between what's referenced in the toc
      and what is created. This is the variant with pep420 disabled.
      """
      outdir = apidoc.outdir
      assert (outdir / "conf.py").is_file()
  
      toc = extract_toc(outdir / "mypackage.rst")
  
      refs = [l.strip() for l in toc.splitlines() if l.strip()]
      found_refs = []
      missing_files = []
      for ref in refs:
          if ref and ref[0] in (":", "#"):
              continue
          filename = f"{ref}.rst"
          found_refs.append(ref)
          if not (outdir / filename).is_file():
              missing_files.append(filename)
  
      assert (
          len(missing_files) == 0
      ), "File(s) referenced in TOC not found: {}\n" "TOC:\n{}".format(
          ", ".join(missing_files), toc
      )
  
imports: import os.path
  from collections import namedtuple
  import pytest
  import sphinx.ext.apidoc
  from sphinx.ext.apidoc import main
label_desc: Use image node_id 16 for calling a global function with example usage: test_toc_all_references_should_exist_pep420_disabled(make_app, apidoc) without return types