"""T4.4 数字孪生测试。 测试数字孪生引擎的模型构建和场景模拟。 """ import pytest from app.services.digital_twin_engine import build_twin_model, simulate_scenario class TestBuildTwinModel: """数字孪生模型构建测试。""" async def test_returns_dict(self): """返回模型参数字典。""" result = await build_twin_model("AI 公司,年营收 2000 万,月烧钱 150 万,跑道 12 个月") assert isinstance(result, dict) async def test_empty_input(self): """空输入返回字典。""" result = await build_twin_model("") assert isinstance(result, dict) class TestSimulateScenario: """场景模拟测试。""" async def test_returns_dict(self): """返回模拟结果字典。""" result = await simulate_scenario( {"revenue_growth_rate": 0.15, "burn_rate": 500000, "runway_months": 18}, "下一轮融资 5000 万", ) assert isinstance(result, dict) async def test_empty_scenario(self): """空场景返回字典。""" result = await simulate_scenario({}, "") assert isinstance(result, dict)