Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
test_invalid_update.py18 linesDownload Raw Back to api
1import numpy as np
2from chromadb.api import ClientAPI
3
4
5def test_invalid_update(client: ClientAPI) -> None:
6    client.reset()
7
8    collection = client.create_collection("test")
9
10    # Update is invalid because ID does not exist
11    collection.update(ids=["foo"], embeddings=[[0.0, 0.0, 0.0]])
12
13    collection.add(ids=["foo"], embeddings=[[1.0, 1.0, 1.0]])
14    result = collection.get(ids=["foo"], include=["embeddings"])
15    # Embeddings should be the same as what was provided to .add()
16    assert result["embeddings"] is not None
17    assert np.allclose(result["embeddings"][0], np.array([1.0, 1.0, 1.0]))
18 
codekingpro/portable-devtools · Team Ai