generated from coulomb/repo-seed
T01: markidocx inspect (FR-806) and markidocx test (FR-810) CLI commands
T02: markidocx evidence get/list CLI commands (FR-1409, FR-814)
T03: list_styles() / GET /styles / MCP list_styles with real style data (FR-907)
T04: Evidence assembly — EvidenceSet summary via REST and MCP (FR-1406–1408)
T05: LEVEL3 edge-case tests — diagram mutation, renderer version check,
bibliography duplicate keys / missing refs / special chars (FR-534, FR-538, FR-542)
T06: markidocx template extract + Word-first round-trip regression test (FR-606)
New: differ._compare_diagram_blocks tracks fenced diagram source drift (FR-534)
New: diagrams.check_renderer_version emits warning for outdated renderers (FR-538)
New: bibliography.validate_citations detects duplicate keys and missing entries (FR-542)
New: templates.extract_template / TemplateExtractionResult / list_styles / StyleEntry
New: REST POST /template/extract; MCP extract_template tool
278 tests pass, ruff+mypy clean.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
56 lines
1.6 KiB
Python
56 lines
1.6 KiB
Python
"""Generate the word_first/source.docx fixture for T06 regression tests.
|
||
|
||
Run this script once to (re)generate the fixture:
|
||
python tests/regression/fixtures/word_first/generate.py
|
||
|
||
The generated source.docx is committed as a stable binary fixture.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from pathlib import Path
|
||
|
||
from docx import Document
|
||
|
||
|
||
def generate_source_docx(out_path: Path) -> None:
|
||
"""Create a representative Word document with headings, body, table, image placeholder, footer."""
|
||
doc = Document()
|
||
|
||
# Heading 1
|
||
doc.add_heading("Introduction", level=1)
|
||
|
||
# Body paragraphs
|
||
doc.add_paragraph("This is the first paragraph of the introduction.")
|
||
doc.add_paragraph("A second paragraph with some **notable** content.")
|
||
|
||
# Heading 2
|
||
doc.add_heading("Background", level=2)
|
||
doc.add_paragraph("Some background text explaining the context.")
|
||
|
||
# A simple 2×2 table
|
||
table = doc.add_table(rows=2, cols=2)
|
||
table.cell(0, 0).text = "Header A"
|
||
table.cell(0, 1).text = "Header B"
|
||
table.cell(1, 0).text = "Value 1"
|
||
table.cell(1, 1).text = "Value 2"
|
||
|
||
# Heading 2 — Conclusion
|
||
doc.add_heading("Conclusion", level=2)
|
||
doc.add_paragraph("This concludes the document.")
|
||
|
||
# Footer
|
||
section = doc.sections[0]
|
||
footer = section.footer
|
||
footer_para = footer.paragraphs[0]
|
||
footer_para.text = "Page footer — fixture document"
|
||
|
||
out_path.parent.mkdir(parents=True, exist_ok=True)
|
||
doc.save(str(out_path))
|
||
print(f"Generated: {out_path}")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
here = Path(__file__).parent
|
||
generate_source_docx(here / "source.docx")
|