(tmp_path)
| 58 | |
| 59 | |
| 60 | def 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 |
nothing calls this directly
no test coverage detected