(self, engine, store)
| 116 | |
| 117 | class TestScenarioStoreCompare: |
| 118 | def test_compare_basic(self, engine, store): |
| 119 | stats_a = _mock_stats() |
| 120 | stats_b = {**_mock_stats(), "decision_metrics": { |
| 121 | "acceptance_rate": 0.9, |
| 122 | "completion_rate": 0.95, |
| 123 | "avg_scheduling_time": 4.0, |
| 124 | "avg_transmission_time": 100.0, |
| 125 | "throughput_mbps": 200.0, |
| 126 | }} |
| 127 | store.save_scenario("基准", engine, stats_a) |
| 128 | store.save_scenario("扩容", engine, stats_b) |
| 129 | |
| 130 | report = store.compare("基准", "扩容") |
| 131 | assert report["scenario_a"]["name"] == "基准" |
| 132 | assert report["scenario_b"]["name"] == "扩容" |
| 133 | |
| 134 | acc = report["metrics"]["acceptance_rate"] |
| 135 | assert acc["a"] == pytest.approx(0.8) |
| 136 | assert acc["b"] == pytest.approx(0.9) |
| 137 | assert acc["delta"] == pytest.approx(0.1) |
| 138 | assert acc["delta_pct"] == pytest.approx(12.5) |
| 139 | |
| 140 | def test_compare_summary_positive(self, engine, store): |
| 141 | stats_a = _mock_stats() |
nothing calls this directly
no test coverage detected