test(regulatory-info-package): 覆盖材料包主链路
This commit is contained in:
28
tests/test_regulatory_info_package_traceability.py
Normal file
28
tests/test_regulatory_info_package_traceability.py
Normal file
@@ -0,0 +1,28 @@
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user