Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
Pringled committed Nov 29, 2024
1 parent 141900c commit c7c4517
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_vicinity.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,18 @@ def test_vicinity_delete_and_query(vicinity_instance: Vicinity, items: list[str]

# Check that the queried item is in the results
assert "item3" in returned_items


def test_vicinity_evaluate(vicinity_instance: Vicinity, vectors: np.ndarray) -> None:
"""
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.
"""
query_vectors = vectors[:10]
qps, recall = vicinity_instance.evaluate(vectors, query_vectors)

# Ensure the QPS and recall values are within valid ranges
assert qps > 0
assert 0 <= recall <= 1

0 comments on commit c7c4517

Please sign in to comment.