fix(dispatch): Shopee Packing List xlsx 파싱 추가
- 헤더 별칭에 underscore형(order_sn, tracking_number) 추가 - Shopee 는 SKU/수량이 product_info 한 셀에 묶여 있어 전용 파서 추가 · store.parse_shopee_product_info: [n] 단위 상품 분해, SKU/상품명/수량 추출 · parser._parse_shopee: 1행=1주문=1박스, 상품 펼쳐 박스로 묶음, 배송사 SPX 추론 - parse_export(platform) 로 Shopee/일반 경로 분기, 라우터가 platform 전달 - 이름/주소/전화는 xlsx 에 없음 → 라벨 PDF 단계에서 보강 예정 - 테스트 3개 추가 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -81,6 +81,34 @@ def test_column_alias_strip_and_case():
|
||||
assert "seller_sku" in mapping
|
||||
|
||||
|
||||
def test_shopee_product_info_single():
|
||||
blob = ("[1] Product Name:[1+1=3] Mira's Kitchen Korean Grade Miracle Food "
|
||||
"Container Launch PROMO; Variation Name:3x 320ml; Price: RM 20.00; "
|
||||
"Quantity: 1; SKU Reference No.: MT-0320_3;")
|
||||
items = store.parse_shopee_product_info(blob)
|
||||
assert len(items) == 1, items
|
||||
it = items[0]
|
||||
assert it["seller_sku"] == "MT-0320_3", it
|
||||
assert it["quantity"] == 1, it
|
||||
assert it["variation"] == "3x 320ml", it
|
||||
assert "Mira's Kitchen" in it["product_name"], it
|
||||
|
||||
|
||||
def test_shopee_product_info_multi():
|
||||
blob = ("[1] Product Name:Item A; Variation Name:S; Quantity: 2; "
|
||||
"SKU Reference No.: MT-0001; "
|
||||
"[2] Product Name:Item B; Variation Name:L; Quantity: 3; "
|
||||
"SKU Reference No.: MX-0002;")
|
||||
items = store.parse_shopee_product_info(blob)
|
||||
skus = {i["seller_sku"]: i["quantity"] for i in items}
|
||||
assert skus == {"MT-0001": 2, "MX-0002": 3}, skus
|
||||
|
||||
|
||||
def test_shopee_product_info_empty():
|
||||
assert store.parse_shopee_product_info("") == []
|
||||
assert store.parse_shopee_product_info(None) == []
|
||||
|
||||
|
||||
def _run_all():
|
||||
fns = [v for k, v in sorted(globals().items()) if k.startswith("test_") and callable(v)]
|
||||
for fn in fns:
|
||||
|
||||
Reference in New Issue
Block a user