code: def test_vector():
      field = fields.TEXT(vector=True)
      st, codec, seg = _make_codec()
      dw = codec.per_document_writer(st, seg)
      dw.start_doc(0)
      dw.add_field("title", field, None, 1)
      dw.add_vector_items(
          "title",
          field,
          [(u("alfa"), 1.0, b("t1")), (u("bravo"), 2.0, b("t2"))],
      )
      dw.finish_doc()
      dw.close()
      seg.set_doc_count(1)
  
      pdr = codec.per_document_reader(st, seg)
      assert pdr.stored_fields(0) == {}
  
      m = pdr.vector(0, "title", field.vector)
      assert m.is_active()
      ps = []
      while m.is_active():
          ps.append((m.id(), m.weight(), m.value()))
          m.next()
      assert ps == [
          (u("alfa"), 1.0, b("t1")),
          (u("bravo"), 2.0, b("t2")),
      ]
  
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 8 for calling a global function with example usage: test_vector() without return types