#!/usr/bin/env python3
"""
测试LESKA和80776841格式
"""

import sys
import os

# 添加项目根目录到路径
sys.path.insert(0, os.path.join(os.path.dirname(__file__)))

from app.utils.text_parser import ProductCodeExtractor

def test_leska_and_numeric():
    """测试LESKA和80776841格式"""
    extractor = ProductCodeExtractor()
    
    test_cases = [
        {
            'name': "小王国Bogner博格纳女款黑白拼接冰火系列夹克LESKA 8.16",
            'expected': "LESKA",
            'format': "纯大写字母(5位)"
        },
        {
            'name': "GN现货 Burberry 女款黄色起球设计开衫80776841 小王国",
            'expected': "80776841",
            'format': "8位纯数字"
        }
    ]
    
    print("=== LESKA和80776841货号格式测试 ===")
    for i, case in enumerate(test_cases, 1):
        product_code = extractor.extract_product_code(case['name'])
        status = "✓" if product_code == case['expected'] else "✗"
        
        print(f"\n测试 {i}: {status} [{case['format']}]")
        print(f"商品名称: {case['name']}")
        print(f"期望货号: {case['expected']}")
        print(f"实际货号: {product_code}")
        
        if product_code == case['expected']:
            print(f"✅ 匹配成功")
        else:
            print(f"❌ 不匹配！")

if __name__ == "__main__":
    test_leska_and_numeric()