Skip to content

Add ChromaDB Support. #60

Add ChromaDB Support.

Add ChromaDB Support. #60

GitHub Actions / JUnit Test Report failed Sep 25, 2024 in 0s

75 tests run, 70 passed, 4 skipped, 1 failed.

Annotations

Check failure on line 79 in packages/ragbits-document-search/tests/unit/test_chromadb_store.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_chromadb_store.test_get_chroma_collection_with_custom_embedding_function

AssertionError: Expected 'get_or_create_collection' to be called once. Called 2 times.
Calls: [call(name='test_index', metadata={'hnsw:space': 'l2'}),
 call(name='test_index', metadata={'hnsw:space': 'l2'})].
Raw output
custom_embedding_function = <tests.unit.test_chromadb_store.MockEmbeddings object at 0x7f501e7ee620>
mock_chromadb_store_with_custom_embedding_function = ChromaDBStore(index_name=test_index)
mock_chroma_client = <MagicMock id='139982027556608'>

    def test_get_chroma_collection_with_custom_embedding_function(
        custom_embedding_function, mock_chromadb_store_with_custom_embedding_function, mock_chroma_client
    ):
        _ = mock_chromadb_store_with_custom_embedding_function._get_chroma_collection()
    
>       mock_chroma_client.get_or_create_collection.assert_called_once_with(
            name="test_index",
            metadata={"hnsw:space": "l2"},
        )

packages/ragbits-document-search/tests/unit/test_chromadb_store.py:79: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock name='mock.get_or_create_collection' id='139982026916672'>
args = (), kwargs = {'metadata': {'hnsw:space': 'l2'}, 'name': 'test_index'}
msg = "Expected 'get_or_create_collection' to be called once. Called 2 times.\nCalls: [call(name='test_index', metadata={'hnsw:space': 'l2'}),\n call(name='test_index', metadata={'hnsw:space': 'l2'})]."

    def assert_called_once_with(self, /, *args, **kwargs):
        """assert that the mock was called exactly once and that that call was
        with the specified arguments."""
        if not self.call_count == 1:
            msg = ("Expected '%s' to be called once. Called %s times.%s"
                   % (self._mock_name or 'mock',
                      self.call_count,
                      self._calls_repr()))
>           raise AssertionError(msg)
E           AssertionError: Expected 'get_or_create_collection' to be called once. Called 2 times.
E           Calls: [call(name='test_index', metadata={'hnsw:space': 'l2'}),
E            call(name='test_index', metadata={'hnsw:space': 'l2'})].

/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/unittest/mock.py:940: AssertionError