code: def test_todo_valid_link(app, status, warning):
      """
      Test that the inserted "original entry" links for todo items have a target
      that exists in the LaTeX output. The target was previously incorrectly
      omitted (GitHub issue #1020).
      """
      # Ensure the LaTeX output is built.
      app.build(force_all=True)
  
      content = (app.outdir / "python.tex").read_text(encoding="utf8")
  
      # Look for the link to foo. Note that there are two of them because the
      # source document uses todolist twice. We could equally well look for links
      # to bar.
      link = (
          r"{\\hyperref\[\\detokenize{(.*?foo.*?)}]{\\sphinxcrossref{"
          r"\\sphinxstyleemphasis{original entry}}}}"
      )
      m = re.findall(link, content)
      assert len(m) == 4
      target = m[0]
  
      # Look for the targets of this link.
      labels = re.findall(r"\\label{\\detokenize{([^}]*)}}", content)
      matched = [l for l in labels if l == target]
  
      # If everything is correct we should have exactly one target.
      assert len(matched) == 1
  
imports: import re
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_todo_valid_link(app, status, warning) without return types