From bc71c6c4bf0e4d08a0e50b72165826422d696384 Mon Sep 17 00:00:00 2001 From: Spike Lu Date: Tue, 10 Sep 2024 23:04:32 -0700 Subject: [PATCH] add tests for upsert and update with none ids --- chromadb/test/api/test_api_update.py | 10 ++++++++++ chromadb/test/api/test_api_upsert.py | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 chromadb/test/api/test_api_update.py create mode 100644 chromadb/test/api/test_api_upsert.py diff --git a/chromadb/test/api/test_api_update.py b/chromadb/test/api/test_api_update.py new file mode 100644 index 00000000000..a1995e668c7 --- /dev/null +++ b/chromadb/test/api/test_api_update.py @@ -0,0 +1,10 @@ +import pytest +from chromadb.api import ClientAPI + + +def test_update_with_none_ids(client: ClientAPI) -> None: + client.reset() + collection = client.create_collection("test") + with pytest.raises(ValueError) as e: + collection.update(ids=None, embeddings=[[0.1, 0.2, 0.3]]) # type: ignore[arg-type] + assert "You must provide ids." in str(e) diff --git a/chromadb/test/api/test_api_upsert.py b/chromadb/test/api/test_api_upsert.py new file mode 100644 index 00000000000..5aced3f6980 --- /dev/null +++ b/chromadb/test/api/test_api_upsert.py @@ -0,0 +1,10 @@ +import pytest +from chromadb.api import ClientAPI + + +def test_upsert_with_none_ids(client: ClientAPI) -> None: + client.reset() + collection = client.create_collection("test") + with pytest.raises(ValueError) as e: + collection.upsert(ids=None, embeddings=[[0.1, 0.2, 0.3]]) # type: ignore[arg-type] + assert "You must provide ids." in str(e)