code: def test_term_values():
      field = fields.TEXT(phrase=False)
      st, codec, seg = _make_codec()
      content = u("alfa bravo charlie alfa")
  
      fw = codec.field_writer(st, seg)
      fw.start_field("f1", field)
      for text, freq, weight, val in sorted(field.index(content)):
          fw.start_term(text)
          fw.add(0, weight, val, freq)
          fw.finish_term()
      fw.finish_field()
      fw.close()
  
      tr = codec.terms_reader(st, seg)
      ps = [
          (term, ti.weight(), ti.doc_frequency())
          for term, ti in tr.items()
      ]
      assert ps == [
          (("f1", b("alfa")), 2.0, 1),
          (("f1", b("bravo")), 1.0, 1),
          (("f1", b("charlie")), 1.0, 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 15 for calling a global function with example usage: test_term_values() without return types