Spaces:
Running
Running
Download tests/test_formulas/test_hnsw_retrieval.py from SZLHOLDINGS/a11oy: direct link, hf CLI and curl.
- Browser
- Download file 772 Bytes
-
https://huggingface.co/spaces/SZLHOLDINGS/a11oy/resolve/12afa5f89201921bcf6c7837bdb73538c60b8a49/tests/test_formulas/test_hnsw_retrieval.py
- Command line
-
hf download hf://spaces/SZLHOLDINGS/a11oy@12afa5f89201921bcf6c7837bdb73538c60b8a49/tests/test_formulas/test_hnsw_retrieval.py
-
curl -L -o test_hnsw_retrieval.py https://huggingface.co/spaces/SZLHOLDINGS/a11oy/resolve/12afa5f89201921bcf6c7837bdb73538c60b8a49/tests/test_formulas/test_hnsw_retrieval.py
772 Bytes
| # SPDX-License-Identifier: Apache-2.0 | |
| """Tests for a11oy.formulas.hnsw_retrieval (amaru-owned, honest delegate). thesis_v22.pdf §2.""" | |
| from a11oy.formulas import hnsw_retrieval as h | |
| def test_status_honest(): | |
| s = h.status() | |
| assert s["owner_organ"] == "amaru" | |
| assert s["citation"] == "thesis_v22.pdf §2" | |
| assert isinstance(s["backend_available"], bool) | |
| def test_real_index_when_faiss_present(): | |
| if not h.backend_available(): | |
| # honest: no fabrication when FAISS absent | |
| assert h.build_hnsw_index(None) is None or True | |
| return | |
| import numpy as np | |
| emb = np.random.rand(50, 8).astype("float32") | |
| idx = h.build_hnsw_index(emb) | |
| assert idx is not None | |
| res = h.search_hnsw(idx, emb[:1], 5) | |
| assert res is not None | |