code: def test_create_index_by_key(app):
      # At present, only glossary directive is able to create index key
      text = (
          ".. glossary::\n"
          "\n"
          "   docutils\n"
          "   Python\n"
          "   スフィンクス : ス\n"
      )
      restructuredtext.parse(app, text)
      index = IndexEntries(app.env).create_index(app.builder)
      assert len(index) == 3
      assert index[0] == (
          "D",
          [("docutils", [[("main", "#term-docutils")], [], None])],
      )
      assert index[1] == (
          "P",
          [("Python", [[("main", "#term-Python")], [], None])],
      )
      assert index[2] == (
          "ス",
          [("スフィンクス", [[("main", "#term-0")], [], "ス"])],
      )
  
file_path: sphinx/tests/test_environment/test_environment_indexentries.py
imports: import pytest
  from sphinx.environment.adapters.indexentries import IndexEntries
  from sphinx.testing import restructuredtext
label_desc: Use image node_id 8 for calling a global function with example usage: test_create_index_by_key(app) without return types