from __future__ import annotations

from pathlib import Path

from openpyxl import load_workbook


path = Path("SaaS_E2E测试用例_单Sheet用例测试列表.xlsx")
wb = load_workbook(path)
print(f"sheets={wb.sheetnames}")
for name in wb.sheetnames:
    ws = wb[name]
    print(f"{name}: rows={ws.max_row}, cols={ws.max_column}")

ws = wb["用例测试列表"]
state_rows = sum(1 for row in ws.iter_rows(min_row=2, values_only=True) if row[1] == "订单状态分支用例")
print(f"订单状态分支用例_rows={state_rows}")

patterns = ["source_order_no", "order_title", "strategy_name", "assignment_method"]
hits: list[str] = []
for row in ws.iter_rows():
    for cell in row:
        text = str(cell.value or "")
        for pattern in patterns:
            if pattern in text:
                hits.append(f"{pattern}@{cell.coordinate}")
print("english_var_hits=" + ",".join(hits[:20]))
