23 lines
699 B
Python
23 lines
699 B
Python
import pytest
|
|
from app.crud.qc_task import resolve_task_result_conclusion
|
|
|
|
|
|
def test_empty_ok_for_jxz():
|
|
assert resolve_task_result_conclusion("", "jxz") == ""
|
|
assert resolve_task_result_conclusion(None, "dzx") == ""
|
|
|
|
|
|
def test_tg_btg_ok_for_any_status():
|
|
assert resolve_task_result_conclusion("tg", "ywc") == "tg"
|
|
assert resolve_task_result_conclusion("btg", "jxz") == "btg"
|
|
|
|
|
|
def test_empty_rejected_for_ywc():
|
|
with pytest.raises(ValueError, match="请选择检测结论"):
|
|
resolve_task_result_conclusion("", "ywc")
|
|
|
|
|
|
def test_invalid_code_rejected():
|
|
with pytest.raises(ValueError, match="检测结论无效"):
|
|
resolve_task_result_conclusion("xyz", "jxz")
|