From 81d3f0ec063f5de541cfc6ca46581fd86955054c Mon Sep 17 00:00:00 2001 From: Oliver Rice Date: Wed, 31 Jul 2024 10:43:52 -0500 Subject: [PATCH] test case for issue 90 --- src/tests/test_issue_90.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/tests/test_issue_90.py diff --git a/src/tests/test_issue_90.py b/src/tests/test_issue_90.py new file mode 100644 index 0000000..7c35d6d --- /dev/null +++ b/src/tests/test_issue_90.py @@ -0,0 +1,32 @@ +import vecs + + +def test_upsert(client: vecs.Client) -> None: + # Create a collection + col1 = client.get_or_create_collection(name="col1", dimension=3) + + # Upsert some records + col1.upsert( + records=[ + ( + "vec0", # the vector's identifier + [0.1, 0.2, 0.3], # the vector. list or np.array + {"year": 1973}, # associated metadata + ), + ("vec1", [0.7, 0.8, 0.9], {"year": 2012}), + ] + ) + + # Creat an index on the first collection + col1.create_index() + + # Create a second collection + col2 = client.get_or_create_collection(name="col2", dimension=3) + + # Create an index on the second collection + col2.create_index() + + assert col1.index is not None + assert col2.index is not None + + assert col1.index != col2.index