MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / test_save_load

Function test_save_load

tests/test_index_growth.py:60–76  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

58
59
60def test_save_load(tmp_path):
61 _make_index(tmp_path, n=5)
62 mgr = EmbeddingIndexManager(
63 index_path=tmp_path / "seed_embeddings.npy",
64 labels_path=tmp_path / "seed_labels.json",
65 max_size=100,
66 )
67 vec = np.random.randn(384).astype(np.float32)
68 vec = vec / np.linalg.norm(vec)
69 mgr.add(vec, tier_id=3)
70 mgr.save()
71 mgr2 = EmbeddingIndexManager(
72 index_path=tmp_path / "seed_embeddings.npy",
73 labels_path=tmp_path / "seed_labels.json",
74 max_size=100,
75 )
76 assert mgr2.size == 6

Callers

nothing calls this directly

Calls 4

addMethod · 0.95
saveMethod · 0.95
_make_indexFunction · 0.85

Tested by

no test coverage detected