Files
FamReynaBrain/tools/test_parent_review_contract.py
T
2026-09-14 22:38:47 -04:00

21 lines
819 B
Python

import importlib.util
from pathlib import Path
ROOT = Path(__file__).resolve().parent
spec = importlib.util.spec_from_file_location("render_parent_book", ROOT / "render_parent_book.py")
render_parent_book = importlib.util.module_from_spec(spec)
assert spec.loader
spec.loader.exec_module(render_parent_book)
def test_parent_review_contract_preserves_chapter_anchors_and_rejects_internal_subtitles():
valid = "## Chapter 0: A Beginning\n\nText\n\n## Chapter 1: The Pattern\n\nText\n\n### Reflection and Action\n\nWork"
render_parent_book.validate_parent_review_contract(valid)
def test_parent_review_contract_rejects_missing_chapter_anchor():
import pytest
with pytest.raises(ValueError, match="Chapter 1"):
render_parent_book.validate_parent_review_contract("## Chapter 0: A Beginning\n")