code: def test_glossary(app):
      text = (
          ".. glossary::\n"
          "\n"
          "   term1\n"
          "   TERM2\n"
          "       description\n"
          "\n"
          "   term3 : classifier\n"
          "       description\n"
          "       description\n"
          "\n"
          "   term4 : class1 : class2\n"
          "       description\n"
      )
  
      # doctree
      doctree = restructuredtext.parse(app, text)
      assert_node(
          doctree,
          (
              [
                  glossary,
                  definition_list,
                  (
                      [
                          definition_list_item,
                          (
                              [term, ("term1", index)],
                              [term, ("TERM2", index)],
                              definition,
                          ),
                      ],
                      [
                          definition_list_item,
                          ([term, ("term3", index)], definition),
                      ],
                      [
                          definition_list_item,
                          ([term, ("term4", index)], definition),
                      ],
                  ),
              ],
          ),
      )
      assert_node(
          doctree[0][0][0][0][1],
          entries=[("single", "term1", "term-term1", "main", None)],
      )
      assert_node(
          doctree[0][0][0][1][1],
          entries=[("single", "TERM2", "term-TERM2", "main", None)],
      )
      assert_node(
          doctree[0][0][0][2],
          [definition, nodes.paragraph, "description"],
      )
      assert_node(
          doctree[0][0][1][0][1],
          entries=[
              ("single", "term3", "term-term3", "main", "classifier")
          ],
      )
      assert_node(
          doctree[0][0][1][1],
          [
              definition,
              nodes.paragraph,
              ("description\n" "description"),
          ],
      )
      assert_node(
          doctree[0][0][2][0][1],
          entries=[("single", "term4", "term-term4", "main", "class1")],
      )
      assert_node(
          doctree[0][0][2][1],
          [nodes.definition, nodes.paragraph, "description"],
      )
  
      # index
      domain = app.env.get_domain("std")
      objects = list(domain.get_objects())
      assert (
          "term1",
          "term1",
          "term",
          "index",
          "term-term1",
          -1,
      ) in objects
      assert (
          "TERM2",
          "TERM2",
          "term",
          "index",
          "term-TERM2",
          -1,
      ) in objects
      assert (
          "term3",
          "term3",
          "term",
          "index",
          "term-term3",
          -1,
      ) in objects
      assert (
          "term4",
          "term4",
          "term",
          "index",
          "term-term4",
          -1,
      ) in objects
  
      # term reference (case sensitive)
      refnode = domain.resolve_xref(
          app.env,
          "index",
          app.builder,
          "term",
          "term1",
          pending_xref(),
          nodes.paragraph(),
      )
      assert_node(refnode, nodes.reference, refid="term-term1")
  
      # term reference (case insensitive)
      refnode = domain.resolve_xref(
          app.env,
          "index",
          app.builder,
          "term",
          "term2",
          pending_xref(),
          nodes.paragraph(),
      )
      assert_node(refnode, nodes.reference, refid="term-TERM2")
  
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 6 for calling a global function with example usage: test_glossary(app) without return types