fix: correct test mock paths for rerank chunking tests
This commit is contained in:
parent
4621ee216e
commit
2053af15a4
1 changed files with 8 additions and 3 deletions
|
|
@ -40,7 +40,7 @@ class TestChunkDocumentsForRerank:
|
|||
long_doc = "a" * 2000 # 2000 characters
|
||||
documents = [long_doc, "short doc"]
|
||||
|
||||
with patch("lightrag.rerank.TiktokenTokenizer", side_effect=ImportError):
|
||||
with patch("lightrag.utils.TiktokenTokenizer", side_effect=ImportError):
|
||||
chunked_docs, doc_indices = chunk_documents_for_rerank(
|
||||
documents,
|
||||
max_tokens=100, # 100 tokens = ~400 chars
|
||||
|
|
@ -535,10 +535,15 @@ class TestEndToEndChunking:
|
|||
mock_response.history = None
|
||||
mock_response.headers = {}
|
||||
|
||||
# Create async context manager for response
|
||||
mock_response_cm = AsyncMock()
|
||||
mock_response_cm.__aenter__ = AsyncMock(return_value=mock_response)
|
||||
mock_response_cm.__aexit__ = AsyncMock(return_value=None)
|
||||
|
||||
mock_session = Mock()
|
||||
mock_session.post = AsyncMock(return_value=mock_response)
|
||||
mock_session.post = Mock(return_value=mock_response_cm)
|
||||
mock_session.__aenter__ = AsyncMock(return_value=mock_session)
|
||||
mock_session.__aexit__ = AsyncMock()
|
||||
mock_session.__aexit__ = AsyncMock(return_value=None)
|
||||
|
||||
with patch("aiohttp.ClientSession", return_value=mock_session):
|
||||
result = await cohere_rerank(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue