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

Method test_with_multi_vectors

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

Source from the content-addressed store, hash-verified

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