"""T4.5 知识图谱测试。 测试知识图谱构建和最佳策略匹配。 """ import pytest from app.services.knowledge_graph_builder import build_knowledge_graph, match_best_strategy class TestBuildKnowledgeGraph: """知识图谱构建测试。""" async def test_returns_dict(self): """返回知识图谱字典。""" result = await build_knowledge_graph("企业 A:引入 CTO 后产品迭代速度提升 50%,6 个月后营收增长 30%") assert isinstance(result, dict) async def test_empty_input(self): """空输入返回字典。""" result = await build_knowledge_graph("") assert isinstance(result, dict) class TestMatchBestStrategy: """策略匹配测试。""" async def test_returns_dict(self): """返回策略推荐字典。""" result = await match_best_strategy( "新企业:SaaS 公司,种子轮,团队 10 人", {"nodes": [], "relations": []}, ) assert isinstance(result, dict) async def test_empty_input(self): """空输入返回字典。""" result = await match_best_strategy("", {}) assert isinstance(result, dict)