Files
zkxw/backend/tests/test_storage_release_review_hide_voided.py
T
zlwuandCursor a922ad12f4 feat(storage-release): add hide-voided predicate helpers
Document protocol inactive and all-inbound-WO-void semantics for list filtering.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 13:10:12 +08:00

36 lines
1.5 KiB
Python

from app.core.protocol_status_display import INACTIVE_PROTOCOL_STATUSES
from app.crud.storage_release_review import (
inbound_work_orders_all_void,
is_inactive_protocol_status_for_hide,
)
def test_inactive_protocol_statuses_match_shared_constant():
assert is_inactive_protocol_status_for_hide("yzf") is True
assert is_inactive_protocol_status_for_hide("sdfq") is True
assert is_inactive_protocol_status_for_hide(" SDFQ ") is True
assert is_inactive_protocol_status_for_hide("sxz") is False
assert is_inactive_protocol_status_for_hide("zky") is False
assert is_inactive_protocol_status_for_hide("") is False
assert is_inactive_protocol_status_for_hide(None) is False
assert set(INACTIVE_PROTOCOL_STATUSES) == {"yzf", "sdfq"}
def test_inbound_work_orders_all_void_requires_at_least_one():
assert inbound_work_orders_all_void([]) is False
assert inbound_work_orders_all_void([""]) is False
assert inbound_work_orders_all_void([" "]) is False
def test_inbound_work_orders_all_void_true_when_every_status_is_yzf():
assert inbound_work_orders_all_void(["yzf"]) is True
assert inbound_work_orders_all_void(["yzf", "yzf"]) is True
assert inbound_work_orders_all_void([" YZF ", "yzf"]) is True
def test_inbound_work_orders_all_void_false_when_any_non_void():
assert inbound_work_orders_all_void(["yzf", "ywc"]) is False
assert inbound_work_orders_all_void(["dpz"]) is False
assert inbound_work_orders_all_void(["ywc"]) is False
assert inbound_work_orders_all_void(["yzf", ""]) is False