MCPcopy Create free account
hub / github.com/MinishLab/vicinity / test_vicinity_evaluate

Function test_vicinity_evaluate

tests/test_vicinity.py:318–335  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

316
317
318def 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)

Callers

nothing calls this directly

Calls 1

evaluateMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…