generated from coulomb/repo-seed
WP-0001 (Foundation & LEVEL1 Core):
- manifest model (FR-100), MD→DOCX builder (FR-200), DOCX→MD importer
(FR-300/400), template family registry (FR-600), drift detector (FR-700),
CLI wiring, pre-commit config, CI skeleton, regression harness
WP-0002 (Service Interfaces & Workflow Orchestration):
- REST service via FastAPI (FR-900): /health, /version, /capabilities,
/templates, /styles, /validate, /build, /import, /compare,
/templates/register, /workflows/{name}, /evidence/{run_id}
- Evidence & report store (FR-1400): JSON-backed, per-run, retrievable
through all interfaces, classification (pass/warnings/failed)
- Composite workflow orchestration (FR-1300): single-file-roundtrip,
multi-file-roundtrip, release-regression, family-switch-build
- MCP server via FastMCP (FR-1000): all tools + resources
- CLI additions: `markidocx serve`, `markidocx workflow`, `markidocx mcp`
- Interface parity tests: CLI / REST / MCP produce equivalent results
135 tests passing, ruff + mypy clean.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
52 lines
1.7 KiB
Python
52 lines
1.7 KiB
Python
"""Tests for template family registry (FR-600)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from markidocx.templates import FamilyRegistry, RegistrationError
|
|
|
|
|
|
class TestFamilyRegistry:
|
|
def test_lists_three_builtin_families(self) -> None:
|
|
registry = FamilyRegistry()
|
|
families = registry.list_families()
|
|
names = {f.name for f in families}
|
|
assert names == {"article", "book", "website"}
|
|
|
|
def test_get_existing_family(self) -> None:
|
|
registry = FamilyRegistry()
|
|
info = registry.get("article")
|
|
assert info is not None
|
|
assert info.name == "article"
|
|
assert info.description
|
|
|
|
def test_get_missing_family_returns_none(self) -> None:
|
|
registry = FamilyRegistry()
|
|
assert registry.get("nonexistent") is None
|
|
|
|
def test_register_invalid_path_raises(self, tmp_path: Path) -> None:
|
|
registry = FamilyRegistry()
|
|
with pytest.raises(RegistrationError, match="not found"):
|
|
registry.register(tmp_path / "missing.docx", "custom")
|
|
|
|
def test_register_non_docx_raises(self, tmp_path: Path) -> None:
|
|
f = tmp_path / "template.txt"
|
|
f.write_text("not a docx")
|
|
registry = FamilyRegistry()
|
|
with pytest.raises(RegistrationError, match=".docx"):
|
|
registry.register(f, "custom")
|
|
|
|
def test_create_document_for_each_family(self) -> None:
|
|
registry = FamilyRegistry()
|
|
for family in ("article", "book", "website"):
|
|
doc = registry.create_document(family)
|
|
assert doc is not None
|
|
|
|
def test_create_document_unknown_family_falls_back(self) -> None:
|
|
registry = FamilyRegistry()
|
|
doc = registry.create_document("unknown")
|
|
assert doc is not None
|