更新
This commit is contained in:
@@ -17,13 +17,56 @@ def test_recorded_ancient_book_reference_has_title_chapter_and_pinned_line() ->
|
||||
{
|
||||
"title": "测试古籍",
|
||||
"chapter": "消渴篇",
|
||||
"path": "123-测试古籍.txt",
|
||||
"line": 42,
|
||||
"excerpt": "消渴者,当辨其证。",
|
||||
"url": _URL,
|
||||
"commit": _COMMIT,
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
assert any("《测试古籍》「消渴篇」" in line and _URL in line for line in lines)
|
||||
assert any(
|
||||
"《测试古籍》「消渴篇」" in line
|
||||
and "server/knowledge/tcm-ancient-books/123-测试古籍.txt 第42行" in line
|
||||
and "版本 db0155dc7c42" in line
|
||||
and "摘录:消渴者,当辨其证。" in line
|
||||
for line in lines
|
||||
)
|
||||
assert "https://github.com" not in "\n".join(lines)
|
||||
|
||||
|
||||
def test_locally_bundled_sources_render_without_external_urls() -> None:
|
||||
lines = report_provenance_lines({
|
||||
"prompt_version": "patient-longitudinal-report-nihaixia-ancient-v4",
|
||||
"knowledge_source": {
|
||||
"commit": "270e94e637c4249dc411e54ac6715f21247de3cb",
|
||||
"path": "SKILL.md",
|
||||
"url": "",
|
||||
},
|
||||
"ancient_book_sources": [{
|
||||
"title": "测试古籍",
|
||||
"chapter": "消渴篇",
|
||||
"path": "123-测试古籍.txt",
|
||||
"line": 42,
|
||||
"excerpt": "消渴者,当辨其证。",
|
||||
"commit": _COMMIT,
|
||||
"url": "",
|
||||
}],
|
||||
})
|
||||
assert any("server/knowledge/nihaixia-skill/SKILL.md" in line for line in lines)
|
||||
assert any("server/knowledge/tcm-ancient-books/123-测试古籍.txt 第42行" in line for line in lines)
|
||||
assert "https://github.com" not in "\n".join(lines)
|
||||
|
||||
|
||||
def test_ancient_book_reference_rejects_conflicting_local_metadata() -> None:
|
||||
lines = report_provenance_lines({
|
||||
"ancient_book_sources": [
|
||||
{"title": "测试古籍", "path": "别的书.txt", "line": 42, "url": _URL, "commit": _COMMIT},
|
||||
{"title": "测试古籍", "path": "123-测试古籍.txt", "line": 43, "url": _URL, "commit": _COMMIT},
|
||||
],
|
||||
})
|
||||
assert all("古籍参考:《" not in line for line in lines)
|
||||
|
||||
|
||||
def test_old_or_unverified_report_does_not_gain_ancient_citation() -> None:
|
||||
|
||||
Reference in New Issue
Block a user