code: def test_termindex():
      terms = [
          ("a", "alfa"),
          ("a", "bravo"),
          ("a", "charlie"),
          ("a", "delta"),
          ("b", "able"),
          ("b", "baker"),
          ("b", "dog"),
          ("b", "easy"),
      ]
      st, codec, seg = _make_codec()
      schema = fields.Schema(a=fields.TEXT, b=fields.TEXT)
  
      tw = codec.field_writer(st, seg)
      postings = (
          (fname, b(text), 0, i, b(""))
          for (i, (fname, text)) in enumerate(terms)
      )
      tw.add_postings(schema, FakeLengths(), postings)
      tw.close()
  
      tr = codec.terms_reader(st, seg)
      for i, (fieldname, text) in enumerate(terms):
          assert (fieldname, b(text)) in tr
          ti = tr.term_info(fieldname, b(text))
          assert ti.weight() == i
          assert ti.doc_frequency() == 1
  
imports: from __future__ import with_statement
  import random
  from array import array
  import pytest
  from whoosh import analysis, fields, formats, query
  from whoosh.compat import u, b, text_type
  from whoosh.compat import array_tobytes, xrange
  from whoosh.codec import default_codec
  from whoosh.filedb.filestore import RamStorage
  from whoosh.util.testing import TempStorage
label_desc: Use image node_id 5 for calling a global function with example usage: test_termindex() without return types