code: def test_productionlist(app, status, warning):
      app.build(force_all=True)
  
      warnings = warning.getvalue().split("\n")
      assert len(warnings) == 2
      assert warnings[-1] == ""
      assert (
          "Dup2.rst:4: WARNING: duplicate token description of Dup, other instance in Dup1"
          in warnings[0]
      )
  
      with (app.outdir / "index.html").open("rb") as f:
          etree = HTMLParser(namespaceHTMLElements=False).parse(f)
      ul = list(etree.iter("ul"))[1]
      cases = []
      for li in list(ul):
          assert len(list(li)) == 1
          p = list(li)[0]
          assert p.tag == "p"
          text = str(p.text).strip(" :")
          assert len(list(p)) == 1
          a = list(p)[0]
          assert a.tag == "a"
          link = a.get("href")
          assert len(list(a)) == 1
          code = list(a)[0]
          assert code.tag == "code"
          assert len(list(code)) == 1
          span = list(code)[0]
          assert span.tag == "span"
          linkText = span.text.strip()
          cases.append((text, link, linkText))
      assert cases == [
          ("A", "Bare.html#grammar-token-A", "A"),
          ("B", "Bare.html#grammar-token-B", "B"),
          ("P1:A", "P1.html#grammar-token-P1-A", "P1:A"),
          ("P1:B", "P1.html#grammar-token-P1-B", "P1:B"),
          ("P2:A", "P1.html#grammar-token-P1-A", "P1:A"),
          ("P2:B", "P2.html#grammar-token-P2-B", "P2:B"),
          (
              "Explicit title A, plain",
              "Bare.html#grammar-token-A",
              "MyTitle",
          ),
          (
              "Explicit title A, colon",
              "Bare.html#grammar-token-A",
              "My:Title",
          ),
          (
              "Explicit title P1:A, plain",
              "P1.html#grammar-token-P1-A",
              "MyTitle",
          ),
          (
              "Explicit title P1:A, colon",
              "P1.html#grammar-token-P1-A",
              "My:Title",
          ),
          ("Tilde A", "Bare.html#grammar-token-A", "A"),
          ("Tilde P1:A", "P1.html#grammar-token-P1-A", "A"),
          (
              "Tilde explicit title P1:A",
              "P1.html#grammar-token-P1-A",
              "~MyTitle",
          ),
          (
              "Tilde, explicit title P1:A",
              "P1.html#grammar-token-P1-A",
              "MyTitle",
          ),
          ("Dup", "Dup2.html#grammar-token-Dup", "Dup"),
          (
              "FirstLine",
              "firstLineRule.html#grammar-token-FirstLine",
              "FirstLine",
          ),
          (
              "SecondLine",
              "firstLineRule.html#grammar-token-SecondLine",
              "SecondLine",
          ),
      ]
  
      text = (app.outdir / "LineContinuation.html").read_text(
          encoding="utf8"
      )
      assert "A</strong> ::=  B C D    E F G" in text
  
imports: from unittest import mock
  import pytest
  from docutils import nodes
  from docutils.nodes import definition, definition_list, definition_list_item, term
  from html5lib import HTMLParser
  from sphinx import addnodes
  from sphinx.addnodes import desc, desc_addname, desc_content, desc_name, desc_signature, glossary, index, pending_xref
  from sphinx.domains.std import StandardDomain
  from sphinx.testing import restructuredtext
  from sphinx.testing.util import assert_node
label_desc: Use image node_id 16 for calling a global function with example usage: test_productionlist(app, status, warning) without return types