From 391c4b2f06614cdd0446b1de69fdb5886f17961d Mon Sep 17 00:00:00 2001 From: Luke VanderHart Date: Tue, 18 Apr 2023 14:54:43 -0700 Subject: [PATCH 1/2] fix occasional test failure --- chromadb/test/property/test_collections.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chromadb/test/property/test_collections.py b/chromadb/test/property/test_collections.py index c1087c3f926..d5fc938f5c0 100644 --- a/chromadb/test/property/test_collections.py +++ b/chromadb/test/property/test_collections.py @@ -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: + assert c.metadata == coll["metadata"] self.existing.add(coll["name"]) return coll From be1ee89b68e89931e200dc9f4e6659ac1b54b4c7 Mon Sep 17 00:00:00 2001 From: Luke VanderHart Date: Wed, 19 Apr 2023 10:14:38 -0700 Subject: [PATCH 2/2] add unit test to cover case removed from state machine --- chromadb/test/property/test_collections.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chromadb/test/property/test_collections.py b/chromadb/test/property/test_collections.py index d5fc938f5c0..87ff5f78d3d 100644 --- a/chromadb/test/property/test_collections.py +++ b/chromadb/test/property/test_collections.py @@ -132,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"]