Files
document-haness/tests/helpers.py
T

57 lines
1.8 KiB
Python

from __future__ import annotations
from claridoc.models import Brief, SourcePack
def brief_dict(document_type: str = "technical_blog") -> dict:
return {
"title": "A precise technical document",
"document_type": document_type,
"language": "en-US",
"audience": {
"roles": ["software engineers"],
"prior_knowledge": ["basic programming"],
"needs": ["a decision-ready explanation"],
},
"reader_goal": "choose a safe implementation approach",
"core_message": "Structure claims around reader questions and verify every important step.",
"scope": ["one bounded implementation decision"],
"non_scope": ["vendor-specific defaults"],
"prerequisites": ["a test environment"],
"required_topics": ["mechanism", "evidence", "trade-offs"],
"constraints": {
"target_words": 700,
"tone": "direct and professional",
"version_context": "checked 2026-07-23",
"max_heading_depth": 3,
"require_citations": True,
"allow_external_knowledge": False,
},
"forbidden_claims": ["always safe"],
"metadata": {},
}
def source_dict() -> dict:
return {
"sources": [
{
"id": "S1",
"title": "Authoritative source",
"url": "https://example.com/source",
"publisher": "Example",
"accessed": "2026-07-23",
"facts": ["The bounded mechanism has an observable result."],
"notes": "fixture",
}
]
}
def make_brief(document_type: str = "technical_blog") -> Brief:
return Brief.from_dict(brief_dict(document_type))
def make_sources() -> SourcePack:
return SourcePack.from_dict(source_dict())