test: cover prose contract in planning prompts
This commit is contained in:
+32
-13
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from claridoc.models import Brief, LintReport
|
from claridoc.models import Brief, LintReport
|
||||||
from claridoc.prompts import drafting_prompt, review_prompt, revision_prompt
|
from claridoc.prompts import drafting_prompt, planning_prompt, review_prompt, revision_prompt
|
||||||
from claridoc.structures import create_outline
|
from claridoc.structures import create_outline
|
||||||
from tests.helpers import brief_dict, make_sources
|
from tests.helpers import brief_dict, make_sources
|
||||||
|
|
||||||
@@ -24,35 +24,54 @@ class PromptTests(unittest.TestCase):
|
|||||||
data["constraints"]["style_profile"] = style_profile
|
data["constraints"]["style_profile"] = style_profile
|
||||||
return Brief.from_dict(data)
|
return Brief.from_dict(data)
|
||||||
|
|
||||||
def _prompts(self, brief: Brief) -> tuple[str, str, str]:
|
def _prompts(self, brief: Brief) -> dict[str, str]:
|
||||||
sources = make_sources()
|
sources = make_sources()
|
||||||
outline = create_outline(brief, sources)
|
outline = create_outline(brief, sources)
|
||||||
lint_report = LintReport(score=100.0, word_count=0, issues=[], metrics={})
|
lint_report = LintReport(score=100.0, word_count=0, issues=[], metrics={})
|
||||||
|
|
||||||
draft = drafting_prompt(brief, outline, sources)
|
return {
|
||||||
review = review_prompt(brief, outline, sources, "# draft", lint_report, "editor")
|
"planning": planning_prompt(brief, outline, sources),
|
||||||
revision = revision_prompt(brief, outline, sources, "# draft", lint_report, [])
|
"drafting": drafting_prompt(brief, outline, sources),
|
||||||
return draft, review, revision
|
"review": review_prompt(
|
||||||
|
brief,
|
||||||
|
outline,
|
||||||
|
sources,
|
||||||
|
"# draft",
|
||||||
|
lint_report,
|
||||||
|
"editor",
|
||||||
|
),
|
||||||
|
"revision": revision_prompt(
|
||||||
|
brief,
|
||||||
|
outline,
|
||||||
|
sources,
|
||||||
|
"# draft",
|
||||||
|
lint_report,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
def test_korean_blog_prompts_share_experience_prose_contract(self) -> None:
|
def test_korean_blog_prompts_share_experience_prose_contract(self) -> None:
|
||||||
prompts = self._prompts(self._brief())
|
prompts = self._prompts(self._brief())
|
||||||
|
|
||||||
for prompt in prompts:
|
for stage, prompt in prompts.items():
|
||||||
with self.subTest(stage=prompt[:40]):
|
with self.subTest(stage=stage):
|
||||||
self.assertIn("korean_first_person_experience_v1", prompt)
|
self.assertIn("korean_first_person_experience_v1", prompt)
|
||||||
self.assertIn("저는", prompt)
|
self.assertIn("저는", prompt)
|
||||||
self.assertIn("제가", prompt)
|
self.assertIn("제가", prompt)
|
||||||
self.assertIn("했습니다", prompt)
|
self.assertIn("했습니다", prompt)
|
||||||
self.assertIn("현재 동작과 기술 설명", prompt)
|
self.assertIn("현재 동작과 기술 설명", prompt)
|
||||||
|
|
||||||
self.assertIn("semantic order, never as a sentence template", prompts[0])
|
self.assertIn(
|
||||||
self.assertIn("실제 관찰", prompts[1])
|
"semantic order, never as a sentence template",
|
||||||
self.assertIn("문서 전체", prompts[2])
|
prompts["drafting"],
|
||||||
|
)
|
||||||
|
self.assertIn("실제 관찰", prompts["review"])
|
||||||
|
self.assertIn("문서 전체", prompts["revision"])
|
||||||
|
|
||||||
def test_korean_readme_prompts_share_experience_prose_contract(self) -> None:
|
def test_korean_readme_prompts_share_experience_prose_contract(self) -> None:
|
||||||
prompts = self._prompts(self._brief("readme", style_profile="auto"))
|
prompts = self._prompts(self._brief("readme", style_profile="auto"))
|
||||||
|
|
||||||
for prompt in prompts:
|
for prompt in prompts.values():
|
||||||
self.assertIn("korean_first_person_experience_v1", prompt)
|
self.assertIn("korean_first_person_experience_v1", prompt)
|
||||||
self.assertIn("저는", prompt)
|
self.assertIn("저는", prompt)
|
||||||
self.assertIn("했습니다", prompt)
|
self.assertIn("했습니다", prompt)
|
||||||
@@ -64,7 +83,7 @@ class PromptTests(unittest.TestCase):
|
|||||||
]
|
]
|
||||||
|
|
||||||
for brief in briefs:
|
for brief in briefs:
|
||||||
for prompt in self._prompts(brief):
|
for prompt in self._prompts(brief).values():
|
||||||
self.assertNotIn("korean_first_person_experience_v1", prompt)
|
self.assertNotIn("korean_first_person_experience_v1", prompt)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user