Files
xinmi/docreader/tests/fixtures/generate_issue_2634_fixture.py
T
yawan f7fc992f57
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
WeKnora deployment source with the reviewed wiki identity, summary and recovery fixes
2026-09-22 16:19:06 +08:00

58 lines
2.1 KiB
Python

"""Generate the real DOCX regression fixture for GitHub issue #2634."""
from pathlib import Path
from docx import Document
from docx.enum.table import WD_CELL_VERTICAL_ALIGNMENT
OUTPUT = Path(__file__).with_name("issue_2634_vertical_merge.docx")
def main() -> None:
document = Document()
document.add_heading("遗传病检测项目表", level=1)
document.add_paragraph(
"回归场景:检测方法纵向合并,但每条检测项目在转换后都必须保留该方法。"
)
rows = [
("Q0101", "遗传性乳腺癌", "BRCA1", "15个工作日"),
("Q0102", "遗传性卵巢癌", "BRCA2", "15个工作日"),
("Q0103", "林奇综合征", "MLH1", "15个工作日"),
("Q0104", "家族性腺瘤性息肉病", "APC", "15个工作日"),
]
method = (
"检测方法:提取外周血基因组 DNA,采用高通量测序,并对候选位点进行"
"Sanger 测序验证;检测结果需结合临床表现综合判断。"
)
table = document.add_table(rows=len(rows) + 1, cols=5)
table.style = "Table Grid"
headers = ("项目编号", "检测项目", "相关基因", "周期", "检测方法")
for column, value in enumerate(headers):
table.cell(0, column).text = value
for row_index, row in enumerate(rows, start=1):
for column, value in enumerate(row):
table.cell(row_index, column).text = value
merged_method = table.cell(1, 4).merge(table.cell(len(rows), 4))
merged_method.text = method
merged_method.vertical_alignment = WD_CELL_VERTICAL_ALIGNMENT.CENTER
document.add_paragraph("非合并对照表:相邻单元格内容允许相同,但不应被当作合并。")
control = document.add_table(rows=2, cols=3)
control.style = "Table Grid"
for column, value in enumerate(("列A", "列B", "列C")):
control.cell(0, column).text = value
for column, value in enumerate(("相同值", "相同值", "独立值")):
control.cell(1, column).text = value
document.save(OUTPUT)
print(f"generated={OUTPUT}")
print(f"size={OUTPUT.stat().st_size}")
if __name__ == "__main__":
main()