Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
26 lines
750 B
Python
26 lines
750 B
Python
from replay import _eval_assertion
|
|
|
|
|
|
def test_latency_under_null_latency_ms():
|
|
assertion = {
|
|
"type": "latency_under",
|
|
"params": {"tool": "test_tool", "threshold": 150},
|
|
}
|
|
traj = {
|
|
"turns": [
|
|
{"tool": "test_tool", "latency_ms": None},
|
|
{"tool": "test_tool", "latency_ms": 120},
|
|
]
|
|
}
|
|
ok, msg = _eval_assertion(assertion, traj)
|
|
assert ok
|
|
assert "最大延迟 120.0ms" in msg
|
|
|
|
|
|
def test_latency_under_missing_threshold():
|
|
assertion = {"type": "latency_under", "params": {"tool": "test_tool"}}
|
|
traj = {"turns": [{"tool": "test_tool", "latency_ms": 100}]}
|
|
ok, msg = _eval_assertion(assertion, traj)
|
|
assert not ok
|
|
assert "断言缺失阈值设置" in msg
|