MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / test_avg_latency

Method test_avg_latency

tests/test_stats.py:278–286  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

276 assert rs.count == 1
277
278 def test_avg_latency(self) -> None:
279 rs = RouteStats(storage=InMemoryRouteStatsStorage())
280 r1 = _make_record()
281 r1 = RouteRecord(**{**r1.__dict__, "latency_us": 100.0})
282 r2 = _make_record()
283 r2 = RouteRecord(**{**r2.__dict__, "latency_us": 300.0})
284 rs.record(r1)
285 rs.record(r2)
286 assert abs(rs.summary().avg_latency_us - 200.0) < 0.1
287
288
289@pytest.fixture

Callers

nothing calls this directly

Calls 6

recordMethod · 0.95
summaryMethod · 0.95
RouteStatsClass · 0.90
RouteRecordClass · 0.90
_make_recordFunction · 0.85

Tested by

no test coverage detected