MCPcopy Create free account
hub / github.com/Tong89/smartNode / test_compare_basic

Method test_compare_basic

tests/test_store.py:118–138  ·  view source on GitHub ↗
(self, engine, store)

Source from the content-addressed store, hash-verified

116
117class 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()

Callers

nothing calls this directly

Calls 3

_mock_statsFunction · 0.85
save_scenarioMethod · 0.80
compareMethod · 0.80

Tested by

no test coverage detected