Spaces:
Running
Running
File size: 1,210 Bytes
016b413 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
"""Unit tests for hierarchical orchestration middleware."""
from unittest.mock import AsyncMock
import pytest
from src.middleware.sub_iteration import SubIterationMiddleware
from src.utils.models import AssessmentDetails, JudgeAssessment
pytestmark = pytest.mark.unit
@pytest.mark.asyncio
async def test_sub_iteration_middleware():
team = AsyncMock()
team.execute.return_value = "Result"
judge = AsyncMock()
judge.assess.return_value = JudgeAssessment(
details=AssessmentDetails(
mechanism_score=10,
mechanism_reasoning="Good reasoning text here",
clinical_evidence_score=10,
clinical_reasoning="Good reasoning text here",
drug_candidates=[],
key_findings=[],
),
sufficient=True,
confidence=1.0,
recommendation="synthesize",
next_search_queries=[],
reasoning="Good reasoning text here for the overall assessment which must be long enough.",
)
middleware = SubIterationMiddleware(team, judge)
result, assessment = await middleware.run("task")
assert result == "Result"
assert assessment.sufficient
assert team.execute.call_count == 1
|