fix: align README brief with maintained document
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from claridoc.models import Brief
|
||||
from claridoc.style_contracts import first_person_metrics, plain_form_ending_locations
|
||||
from claridoc.utils import word_count
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
@@ -43,10 +46,20 @@ class RepositoryContractTests(unittest.TestCase):
|
||||
def test_repository_readme_satisfies_korean_experience_contract(self) -> None:
|
||||
text = (ROOT / "README.md").read_text(encoding="utf-8")
|
||||
metrics = first_person_metrics(text)
|
||||
brief = Brief.from_dict(
|
||||
json.loads(
|
||||
(ROOT / "examples" / "briefs" / "claridoc-readme.json").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
)
|
||||
)
|
||||
actual_words = word_count(text)
|
||||
|
||||
self.assertEqual(plain_form_ending_locations(text), [])
|
||||
self.assertTrue(metrics["opening_has_first_person"])
|
||||
self.assertGreaterEqual(metrics["experience_section_coverage"], 0.5)
|
||||
self.assertGreaterEqual(actual_words, brief.constraints.target_words * 0.65)
|
||||
self.assertLessEqual(actual_words, brief.constraints.target_words * 1.6)
|
||||
self.assertIn("STYLE002", text)
|
||||
self.assertIn("STYLE003", text)
|
||||
self.assertIn("examples/briefs/claridoc-readme.json", text)
|
||||
|
||||
Reference in New Issue
Block a user