Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
codetheweb committed Apr 23, 2024
1 parent 2928e91 commit 2ea397a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions chromadb/test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def test_persist_index_loading(api_fixture, request):
for key in nn.keys():
if (key in includes) or (key == "ids"):
assert len(nn[key]) == 1
elif key == "included"
assert nn[key] == includes
else:
assert nn[key] is None

Expand Down Expand Up @@ -118,6 +120,8 @@ def __call__(self, input):
for key in nn.keys():
if (key in includes) or (key == "ids"):
assert len(nn[key]) == 1
elif key == "included"
assert nn[key] == includes
else:
assert nn[key] is None

Expand Down Expand Up @@ -146,6 +150,8 @@ def __call__(self, input):
for key in nn.keys():
if (key in includes) or (key == "ids"):
assert len(nn[key]) == 1
elif key == "included":
assert nn[key] == includes
else:
assert nn[key] is None

Expand Down Expand Up @@ -260,6 +266,8 @@ def test_get_from_db(api):
for key in records.keys():
if (key in includes) or (key == "ids"):
assert len(records[key]) == 2
elif key == "included"
assert records[key] == includes
else:
assert records[key] is None

Expand Down Expand Up @@ -290,6 +298,8 @@ def test_get_nearest_neighbors(api):
for key in nn.keys():
if (key in includes) or (key == "ids"):
assert len(nn[key]) == 1
elif key == "included":
assert nn[key] == includes
else:
assert nn[key] is None

Expand All @@ -302,6 +312,8 @@ def test_get_nearest_neighbors(api):
for key in nn.keys():
if (key in includes) or (key == "ids"):
assert len(nn[key]) == 1
elif key == "included":
assert nn[key] == includes
else:
assert nn[key] is None

Expand All @@ -314,6 +326,8 @@ def test_get_nearest_neighbors(api):
for key in nn.keys():
if (key in includes) or (key == "ids"):
assert len(nn[key]) == 2
elif key == "included":
assert nn[key] == includes
else:
assert nn[key] is None

Expand Down Expand Up @@ -437,6 +451,8 @@ def test_increment_index_on(api):
for key in nn.keys():
if (key in includes) or (key == "ids"):
assert len(nn[key]) == 1
elif key == "included":
assert nn[key] == includes
else:
assert nn[key] is None

Expand Down Expand Up @@ -489,6 +505,8 @@ def test_peek(api):
for key in peek.keys():
if key in ["embeddings", "documents", "metadatas"] or key == "ids":
assert len(peek[key]) == 2
elif key == "included":
assert peek[key] == ["embeddings", "documents", "metadatas"]
else:
assert peek[key] is None

Expand Down Expand Up @@ -1181,6 +1199,8 @@ def test_persist_index_loading_params(api, request):
for key in nn.keys():
if (key in includes) or (key == "ids"):
assert len(nn[key]) == 1
elif key == "included":
assert nn[key] == includes
else:
assert nn[key] is None

Expand Down Expand Up @@ -1299,6 +1319,8 @@ def test_get_nearest_neighbors_where_n_results_more_than_element(api):
for key in results.keys():
if key in includes or key == "ids":
assert len(results[key][0]) == 2
elif key == "included":
assert results[key] == includes
else:
assert results[key] is None

Expand Down

0 comments on commit 2ea397a

Please sign in to comment.