from genesis.qa.report import QAReport from genesis.qa.validator import QAValidator from genesis.writer.models import ChapterContent, ContentBlock def _chapter(cid, text): return ChapterContent( chapter_id=cid, version=1, title=cid, blocks=[ContentBlock(block_id="1", type="paragraph", text=text)], ) def test_validate_doc_aggregates_qa_report(): v = QAValidator() report = v.validate_doc( [_chapter("a", "充分且规范的说明内容,满足写入规则要求。"), _chapter("b", "x")], None ) assert isinstance(report, QAReport) assert report.passed is False assert "b" in report.failed_chapters assert isinstance(report.overall_score, float) assert len(report.per_chapter) == 2 assert "未通过" in report.summary