student-score-prediction/tests/test_counselor_agent.py
柘黎思 d2098227fb
All checks were successful
autograde-assignment-05-final-project / check-trigger (push) Successful in 12s
autograde-assignment-05-final-project / grade (push) Has been skipped
feat: 上传课程设计完整代码
2026-01-12 11:06:20 +08:00

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