feat(regulatory): 增加法规核查基础服务
This commit is contained in:
24
tests/test_regulatory_text_extract.py
Normal file
24
tests/test_regulatory_text_extract.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from pathlib import Path
|
||||
|
||||
from review_agent.regulatory_review.services.text_extract import extract_text
|
||||
|
||||
|
||||
def test_extract_text_reads_plain_text(tmp_path):
|
||||
path = tmp_path / "说明书.txt"
|
||||
path.write_text("产品名称:甲胎蛋白检测试剂盒\n储存条件:2-8℃", encoding="utf-8")
|
||||
|
||||
result = extract_text(path)
|
||||
|
||||
assert "甲胎蛋白" in result.text
|
||||
assert result.status == "success"
|
||||
assert result.content_hash
|
||||
|
||||
|
||||
def test_extract_text_reports_unsupported_file(tmp_path):
|
||||
path = tmp_path / "image.png"
|
||||
path.write_bytes(b"png")
|
||||
|
||||
result = extract_text(path)
|
||||
|
||||
assert result.status == "unsupported"
|
||||
assert result.text == ""
|
||||
Reference in New Issue
Block a user