MCPcopy Create free account
hub / github.com/alibaba/zvec / test_with_multi_vectors

Method test_with_multi_vectors

python/tests/test_doc.py:46–64  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

44 assert doc.vector("sparse") == {1: 1.0, 2: 2.0, 3: 3.0}
45
46 def test_with_multi_vectors(self):
47 doc = Doc(
48 id="1",
49 vectors={
50 "image": [1, 2, 3],
51 "description": [4, 5, 6],
52 "keys": {1: 1.0, 2: 2.0, 3: 3.0},
53 },
54 fields={"author": "Tom", "age": 19, "is_male": True, "weight": 60.5},
55 )
56 assert doc is not None
57 assert doc.id == "1"
58 assert doc.vector("image") == [1, 2, 3]
59 assert doc.vector("description") == [4, 5, 6]
60 assert doc.vector("keys") == {1: 1.0, 2: 2.0, 3: 3.0}
61 assert doc.field("author") == "Tom"
62 assert doc.field("age") == 19
63 assert doc.field("is_male") == True
64 assert doc.field("weight") == 60.5
65
66 def test_with_numpy_array(self):
67 import numpy as np

Callers

nothing calls this directly

Calls 3

vectorMethod · 0.95
fieldMethod · 0.95
DocClass · 0.90

Tested by

no test coverage detected