42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
|
|
"""Shared fixtures for minimal reference bundle trees in batch/subprocess tests."""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
import yaml
|
||
|
|
|
||
|
|
|
||
|
|
def complete_result_tsv_body() -> str:
|
||
|
|
return (
|
||
|
|
"rank\tstart_sec\tend_sec\tproduct_id_top1\ttop1_name\ttop1_conf\n"
|
||
|
|
"1\t0\t1\tP1\t耗材1\t1.0\n"
|
||
|
|
"医生信息:测试医生 (id=123, conf=0.99)\n"
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
def write_minimal_reference_bundle(bundle: Path) -> None:
|
||
|
|
bundle.mkdir(parents=True)
|
||
|
|
(bundle / "main.py").write_text("# fake\n", encoding="utf-8")
|
||
|
|
(bundle / "code").mkdir()
|
||
|
|
(bundle / "code" / "repo_root.py").write_text("# fake\n", encoding="utf-8")
|
||
|
|
(bundle / "configs").mkdir()
|
||
|
|
(bundle / "configs" / "default_config.yaml").write_text(
|
||
|
|
yaml.safe_dump(
|
||
|
|
{
|
||
|
|
"io": {"video": "", "excel": "", "out": "", "whitelist_json": None},
|
||
|
|
"weights": {},
|
||
|
|
"runtime": {"work_dir": None, "keep_work_dir": False, "python": None},
|
||
|
|
"device": {},
|
||
|
|
"phase1": {},
|
||
|
|
"phase2": {},
|
||
|
|
"classification": {},
|
||
|
|
"tear_merge": {},
|
||
|
|
"output": {},
|
||
|
|
},
|
||
|
|
allow_unicode=True,
|
||
|
|
sort_keys=False,
|
||
|
|
),
|
||
|
|
encoding="utf-8",
|
||
|
|
)
|