Test the evaluate method of the Vicinity instance. :param vicinity_instance: A Vicinity instance. :param vectors: The full dataset vectors used to build the index.
(vicinity_instance: Vicinity, vectors: np.ndarray)
| 316 | |
| 317 | |
| 318 | def test_vicinity_evaluate(vicinity_instance: Vicinity, vectors: np.ndarray) -> None: |
| 319 | """ |
| 320 | Test the evaluate method of the Vicinity instance. |
| 321 | |
| 322 | :param vicinity_instance: A Vicinity instance. |
| 323 | :param vectors: The full dataset vectors used to build the index. |
| 324 | """ |
| 325 | query_vectors = vectors[:10] |
| 326 | qps, recall = vicinity_instance.evaluate(vectors, query_vectors) |
| 327 | |
| 328 | # Ensure the QPS and recall values are within valid ranges |
| 329 | assert qps > 0 |
| 330 | assert 0 <= recall <= 1 |
| 331 | |
| 332 | # Test with an unsupported metric |
| 333 | vicinity_instance.backend.arguments.metric = "manhattan" |
| 334 | with pytest.raises(ValueError): |
| 335 | vicinity_instance.evaluate(vectors, query_vectors) |
nothing calls this directly
no test coverage detected
searching dependent graphs…