Files
PlantAI-dev/tests/unit/test_subfamily_review_source_manifest.py
2026-08-03 18:42:47 +08:00

34 lines
1.2 KiB
Python
Executable File

from __future__ import annotations
import json
from pathlib import Path
def test_source_prediction_manifest_path_prefers_reference_classification_manifest(monkeypatch, tmp_path):
from apps.web.vue3 import main as web_main
job_id = "job_source_manifest"
final_dir = tmp_path / "workspace" / job_id / "final"
final_dir.mkdir(parents=True)
monkeypatch.setattr(web_main, "WORKSPACE_ROOT", tmp_path / "workspace")
monkeypatch.setattr(web_main, "INPUT_ROOT", tmp_path / "input")
web_main.INPUT_ROOT.mkdir(parents=True, exist_ok=True)
manifest_path = final_dir / "Lc.SPL.target_plus_reference.reference_classification.manifest.json"
manifest_path.write_text(
json.dumps(
{
"manifest_version": "1.0",
"stage": "reference_classification",
"status": "success",
"prefix": "Lc.SPL",
"output_prefix": "Lc.SPL.target_plus_reference",
"scope_id": "SPL.target-Lc.ref-At.target_plus_reference",
"analysis_route": "subfamily_prediction",
}
),
encoding="utf-8",
)
assert web_main._source_prediction_manifest_path(job_id, "Lc.SPL") == manifest_path