Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix occasional Hypothesis test failure when calling get_or_create_collection #379

Merged
merged 2 commits into from
Apr 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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:
HammadB marked this conversation as resolved.
Show resolved Hide resolved
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"]