File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,18 @@ async def test_get_collection():
242
242
mock_client .get_collection .assert_called_once ()
243
243
mock_client .get_or_create_collection .assert_not_called ()
244
244
245
+ # Test retrieving a non-existing collection
246
+ with patch ("chromadb.AsyncHttpClient" ) as MockAsyncHttpClient :
247
+ from vectorcode .common import __COLLECTION_CACHE
248
+
249
+ __COLLECTION_CACHE .clear ()
250
+ mock_client = MagicMock (spec = AsyncClientAPI )
251
+ mock_client .get_collection .side_effect = ValueError
252
+ MockAsyncHttpClient .return_value = mock_client
253
+
254
+ with pytest .raises (ValueError ):
255
+ collection = await get_collection (mock_client , config , False )
256
+
245
257
# Test creating a collection if it doesn't exist
246
258
with patch ("chromadb.AsyncHttpClient" ) as MockAsyncHttpClient :
247
259
mock_client = MagicMock (spec = AsyncClientAPI )
You can’t perform that action at this time.
0 commit comments