Files
shanxia2.0/backend/tests/test_pl_plan_list_attachments.py
2026-08-27 14:23:18 +08:00

34 lines
1.0 KiB
Python

"""运输计划列表单据附件聚合"""
from app.services.pl_plan_list_attachments import (
_parse_image_urls,
_stop_source_label,
)
def test_parse_image_urls_json_array():
assert _parse_image_urls('["https://a/1.jpg","https://a/2.jpg"]') == [
"https://a/1.jpg",
"https://a/2.jpg",
]
def test_parse_image_urls_csv():
assert _parse_image_urls("https://a/1.jpg, https://a/2.jpg") == [
"https://a/1.jpg",
"https://a/2.jpg",
]
def test_stop_source_label_load():
assert _stop_source_label("load", "load-1", "司机", {}) == "装货·司机"
assert _stop_source_label("load", "load-1", "现场", {}) == "装货·现场"
def test_stop_source_label_delivery_with_seq():
assert _stop_source_label("delivery", "d-1", "司机", {"d-1": 2}) == "送货#2·司机"
assert _stop_source_label("delivery", "d-1", "现场", {"d-1": 2}) == "送货#2·现场"
def test_stop_source_label_delivery_without_seq():
assert _stop_source_label("delivery", "d-1", "现场", {}) == "送货·现场"