40 lines
937 B
Python
40 lines
937 B
Python
"""咨询师 Agent 测试"""
|
|
|
|
import os
|
|
|
|
import pytest
|
|
|
|
os.environ["DEEPSEEK_API_KEY"] = "dummy_key_for_testing"
|
|
|
|
from src.agent_app import AgentDeps, counselor_agent
|
|
from src.features import StudentFeatures
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_deps() -> AgentDeps:
|
|
"""创建测试用依赖"""
|
|
return AgentDeps(
|
|
student=StudentFeatures(
|
|
study_hours=10,
|
|
sleep_hours=6,
|
|
attendance_rate=0.8,
|
|
stress_level=4,
|
|
study_type="Group",
|
|
)
|
|
)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_counselor_agent_structure():
|
|
"""测试咨询师 Agent 结构"""
|
|
assert counselor_agent is not None
|
|
assert hasattr(counselor_agent, "run")
|
|
assert hasattr(counselor_agent, "run_stream")
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_counselor_agent_deps_type():
|
|
"""测试 Agent 依赖类型"""
|
|
# 验证 deps_type 设置正确
|
|
assert counselor_agent._deps_type == AgentDeps
|