Skip to content

Commit

Permalink
test case for issue 90
Browse files Browse the repository at this point in the history
  • Loading branch information
olirice committed Jul 31, 2024
1 parent a6a2aea commit 81d3f0e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/tests/test_issue_90.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 81d3f0e

Please sign in to comment.