29 lines
863 B
Python
29 lines
863 B
Python
from pathlib import Path
|
|
|
|
from openpyxl import load_workbook
|
|
|
|
from review_agent.regulatory_info_package.schemas import MergedField
|
|
from review_agent.regulatory_info_package.services.traceability_export import save_traceability_exports
|
|
|
|
|
|
def test_save_traceability_exports_writes_excel_and_json(tmp_path):
|
|
fields = {
|
|
"product_name": MergedField(
|
|
key="product_name",
|
|
label="产品名称",
|
|
value="测试产品",
|
|
source="rule",
|
|
evidence="说明书",
|
|
confidence=0.9,
|
|
)
|
|
}
|
|
|
|
excel_path, json_path = save_traceability_exports(tmp_path, fields)
|
|
|
|
assert excel_path.name == "traceability.xlsx"
|
|
assert json_path.name == "traceability.json"
|
|
assert json_path.exists()
|
|
workbook = load_workbook(excel_path)
|
|
assert workbook.active["A1"].value == "target_file"
|
|
|