Skip to content

Commit

Permalink
Merge pull request #379 from chroma-core/lukev/fix-coll-upsert-failure
Browse files Browse the repository at this point in the history
Fix occasional Hypothesis test failure when calling `get_or_create_collection`
  • Loading branch information
levand authored Apr 19, 2023
2 parents 0ad2b40 + be1ee89 commit 29dff1a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion chromadb/test/property/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def list_collections(self):
def get_or_create_coll(self, coll):
c = self.api.get_or_create_collection(**coll)
assert c.name == coll["name"]
assert c.metadata == coll["metadata"]
if coll["metadata"] is not None:
assert c.metadata == coll["metadata"]
self.existing.add(coll["name"])
return coll

Expand Down Expand Up @@ -131,3 +132,11 @@ def test_upsert_metadata_example(api):
v1 = state.create_coll(coll={"name": "E40", "metadata": None})
state.get_or_create_coll(coll={"name": "E40", "metadata": {"foo": "bar"}})
state.teardown()


def test_create_coll_with_none_metadata(api):
coll = {"name": "foo", "metadata": None}
api.reset()
c = api.get_or_create_collection(**coll)
assert c.name == coll["name"]
assert c.metadata == coll["metadata"]

0 comments on commit 29dff1a

Please sign in to comment.