refactor: Clean up test_edge_operations.py and format response returns
- Remove unnecessary stubs for opensearchpy module. - Format return values in llm_client.generate_response for consistency. - Enhance readability by ensuring proper indentation and structure in test cases. This refactor improves the clarity and maintainability of the test suite for edge operations.
This commit is contained in:
parent
e5337d3504
commit
46771eb90b
1 changed files with 10 additions and 9 deletions
|
|
@ -1,14 +1,7 @@
|
||||||
import sys
|
|
||||||
import types
|
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from unittest.mock import AsyncMock, MagicMock
|
from unittest.mock import AsyncMock, MagicMock
|
||||||
|
|
||||||
opensearch_stub = types.ModuleType('opensearchpy')
|
|
||||||
opensearch_stub.AsyncOpenSearch = None
|
|
||||||
opensearch_stub.helpers = None
|
|
||||||
sys.modules.setdefault('opensearchpy', opensearch_stub)
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
@ -179,7 +172,11 @@ async def test_resolve_extracted_edges_resets_unmapped_names(monkeypatch):
|
||||||
|
|
||||||
llm_client = MagicMock()
|
llm_client = MagicMock()
|
||||||
llm_client.generate_response = AsyncMock(
|
llm_client.generate_response = AsyncMock(
|
||||||
return_value={'duplicate_facts': [], 'contradicted_facts': [], 'fact_type': 'DEFAULT'}
|
return_value={
|
||||||
|
'duplicate_facts': [],
|
||||||
|
'contradicted_facts': [],
|
||||||
|
'fact_type': 'DEFAULT',
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
clients = SimpleNamespace(
|
clients = SimpleNamespace(
|
||||||
|
|
@ -256,7 +253,11 @@ async def test_resolve_extracted_edges_keeps_unknown_names(monkeypatch):
|
||||||
|
|
||||||
llm_client = MagicMock()
|
llm_client = MagicMock()
|
||||||
llm_client.generate_response = AsyncMock(
|
llm_client.generate_response = AsyncMock(
|
||||||
return_value={'duplicate_facts': [], 'contradicted_facts': [], 'fact_type': 'DEFAULT'}
|
return_value={
|
||||||
|
'duplicate_facts': [],
|
||||||
|
'contradicted_facts': [],
|
||||||
|
'fact_type': 'DEFAULT',
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
clients = SimpleNamespace(
|
clients = SimpleNamespace(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue