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

Method test_init_normalizes_numpy_vectors

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

Source from the content-addressed store, hash-verified

85 assert doc.vector("keys") == {1: 1.0, 2: 2.0, 3: 3.0}
86
87 def test_init_normalizes_numpy_vectors(self):
88 import numpy as np
89
90 doc = Doc(id="1", vectors={"dense": np.array([1, 2, 3])})
91
92 assert doc.vector("dense") == [1, 2, 3]
93 assert json.loads(repr(doc))["vectors"]["dense"] == [1, 2, 3]
94
95
96# ----------------------------

Callers

nothing calls this directly

Calls 2

vectorMethod · 0.95
DocClass · 0.90

Tested by

no test coverage detected