mirror of
https://github.com/imartinez/privateGPT.git
synced 2026-07-16 17:00:12 +00:00
fix: tests
This commit is contained in:
@@ -119,9 +119,8 @@ def setup_mock_llm(
|
||||
)
|
||||
|
||||
llm_component = injector.get(LLMComponent)
|
||||
llm_component.llm = mock_llm_instance
|
||||
llm_component.get_llm.return_value = mock_llm_instance
|
||||
injector.bind_mock(LLMComponent, mock_llm_instance)
|
||||
llm_component.get_llm = Mock(return_value=mock_llm_instance)
|
||||
injector.bind_mock(LLMComponent, llm_component)
|
||||
|
||||
|
||||
def create_mock_http_client(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import uuid
|
||||
from collections.abc import Iterator
|
||||
from typing import Any, get_args
|
||||
from unittest.mock import Mock
|
||||
|
||||
import anthropic
|
||||
import httpx
|
||||
@@ -139,9 +140,8 @@ def setup_mock_llm(
|
||||
)
|
||||
|
||||
llm_component = injector.get(LLMComponent)
|
||||
llm_component.llm = mock_llm_instance
|
||||
llm_component.get_llm.return_value = mock_llm_instance
|
||||
injector.bind_mock(LLMComponent, mock_llm_instance)
|
||||
llm_component.get_llm = Mock(return_value=mock_llm_instance)
|
||||
injector.bind_mock(LLMComponent, llm_component)
|
||||
|
||||
|
||||
def create_mock_http_client(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import uuid
|
||||
from typing import Any
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
from httpx import AsyncClient
|
||||
@@ -72,9 +73,8 @@ async def mock_llm_with_capture(
|
||||
mock_llm_instance.astream_chat_with_tools = coro
|
||||
|
||||
llm_component = injector.get(LLMComponent)
|
||||
llm_component.llm = mock_llm_instance
|
||||
llm_component.get_llm.return_value = mock_llm_instance
|
||||
injector.bind_mock(LLMComponent, mock_llm_instance)
|
||||
llm_component.get_llm = Mock(return_value=mock_llm_instance)
|
||||
injector.bind_mock(LLMComponent, llm_component)
|
||||
|
||||
|
||||
def create_tool_definition(
|
||||
|
||||
@@ -3,7 +3,7 @@ import json
|
||||
import uuid
|
||||
from collections.abc import AsyncGenerator
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock
|
||||
from unittest.mock import AsyncMock, Mock
|
||||
|
||||
import pytest
|
||||
from httpx import AsyncClient
|
||||
@@ -107,9 +107,8 @@ async def mock_llm(
|
||||
mock_llm = get_mock_function_calling_llm(deltas)
|
||||
|
||||
llm_component = injector.get(LLMComponent)
|
||||
llm_component.llm = mock_llm
|
||||
llm_component.get_llm.return_value = mock_llm
|
||||
injector.bind_mock(LLMComponent, mock_llm)
|
||||
llm_component.get_llm = Mock(return_value=mock_llm)
|
||||
injector.bind_mock(LLMComponent, llm_component)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
|
||||
@@ -73,7 +73,7 @@ async def mock_llm_with_capture(
|
||||
mock_llm.astream_chat_with_tools = coro
|
||||
llm_component = injector.get(LLMComponent)
|
||||
llm_component.llm = mock_llm
|
||||
llm_component.get_llm.return_value = mock_llm
|
||||
llm_component.get_llm.side_effect = lambda *args, **kwargs: mock_llm
|
||||
injector.bind_mock(LLMComponent, mock_llm)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user