import pytest from app.core.protocol_status_display import ( assert_protocol_status_transition, status_transition_denied_message, ) def test_expired_protocol_cannot_void_and_message_uses_chinese_labels(): assert status_transition_denied_message("ygq", "yzf") == "状态已过期不可转为已作废" assert status_transition_denied_message("ygq", "yzf", kind="donation") == "状态已过期不可转为已作废" with pytest.raises(ValueError, match="状态已过期不可转为已作废"): assert_protocol_status_transition("ygq", "yzf", kind="protocol") with pytest.raises(ValueError, match="状态已过期不可转为已作废"): assert_protocol_status_transition("ygq", "yzf", kind="donation") def test_active_protocol_can_void_and_same_status_is_allowed(): assert_protocol_status_transition("sxz", "yzf", kind="protocol") assert_protocol_status_transition("sxz", "zky", kind="protocol") assert_protocol_status_transition("sxz", "zckc", kind="donation") assert_protocol_status_transition("ygq", "ygq", kind="protocol") assert_protocol_status_transition("ygq", "ygq", kind="donation")