更新
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from doctor_workstation.ui.report_provenance import report_provenance_lines
|
||||
|
||||
_COMMIT = "db0155dc7c42b9c6b3736896661f317c7110038f"
|
||||
_URL = (
|
||||
"https://github.com/xiaopangxia/TCM-Ancient-Books/blob/"
|
||||
f"{_COMMIT}/123-%E6%B5%8B%E8%AF%95%E5%8F%A4%E7%B1%8D.txt#L42"
|
||||
)
|
||||
|
||||
|
||||
def test_recorded_ancient_book_reference_has_title_chapter_and_pinned_line() -> None:
|
||||
lines = report_provenance_lines(
|
||||
{
|
||||
"prompt_version": "patient-longitudinal-report-nihaixia-ancient-v4",
|
||||
"ancient_book_sources": [
|
||||
{
|
||||
"title": "测试古籍",
|
||||
"chapter": "消渴篇",
|
||||
"url": _URL,
|
||||
"commit": _COMMIT,
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
assert any("《测试古籍》「消渴篇」" in line and _URL in line for line in lines)
|
||||
|
||||
|
||||
def test_old_or_unverified_report_does_not_gain_ancient_citation() -> None:
|
||||
lines = report_provenance_lines(
|
||||
{
|
||||
"prompt_version": "patient-longitudinal-report-nihaixia-v3",
|
||||
"ancient_book_sources": [
|
||||
{"title": "伪造", "url": _URL.replace(_COMMIT, "0" * 40), "commit": _COMMIT}
|
||||
],
|
||||
}
|
||||
)
|
||||
assert all("古籍参考:《" not in line for line in lines)
|
||||
Reference in New Issue
Block a user