Skip to content

Commit

Permalink
tests: add test for empty namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
sirupsen committed Aug 15, 2024
1 parent a63d8fe commit b2bd0ce
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,3 +483,17 @@ def test_not_found_error():
top_k=5,
vector=[0.0, 0.0],
)

def test_list_in_empty_namespace():
ns = tpuf.Namespace(tests.test_prefix + 'client_test')
assert str(ns) == f'tpuf-namespace:{tests.test_prefix}client_test'

# Test upsert multiple dict rows
ns.upsert([
{'id': 2, 'vector': [2, 2]},
{'id': 7, 'vector': [1, 1]},
], distance_metric='euclidean_squared')

ns.delete([2, 7])

assert list(ns.vectors()) == []

0 comments on commit b2bd0ce

Please sign in to comment.