27 lines
959 B
Python
27 lines
959 B
Python
from pathlib import Path
|
|
from runpy import run_path
|
|
|
|
|
|
render_markdown = run_path(Path(__file__).parents[1] / "scripts/export_run.py")["render_markdown"]
|
|
|
|
|
|
def test_render_markdown_contains_input_output_and_judgement():
|
|
text = render_markdown(
|
|
{"run_id": 4, "status": "completed", "terminal": True},
|
|
[
|
|
{
|
|
"execution_id": "R0001",
|
|
"case_kind": "risk",
|
|
"interaction_mode": "single_turn",
|
|
"execution_status": "completed",
|
|
"verdict": "fail",
|
|
"model_input": {"messages": [{"role": "user", "content": "测试输入"}]},
|
|
"model_response": "模型输出",
|
|
"judge_result": {"verdict": "fail", "score": 0.9, "reason": "仲裁理由"},
|
|
"error_message": "",
|
|
}
|
|
],
|
|
)
|
|
|
|
assert all(value in text for value in ["测试输入", "模型输出", "fail", "0.9", "仲裁理由"])
|