feat: propagate Korean prose contract to providers
This commit is contained in:
+44
-12
@@ -9,17 +9,22 @@ from tests.helpers import brief_dict, make_sources
|
||||
|
||||
|
||||
class PromptTests(unittest.TestCase):
|
||||
def _korean_blog(self) -> Brief:
|
||||
data = brief_dict()
|
||||
def _brief(
|
||||
self,
|
||||
document_type: str = "technical_blog",
|
||||
*,
|
||||
language: str = "ko-KR",
|
||||
style_profile: str = "woowahan_tech_blog_ko",
|
||||
) -> Brief:
|
||||
data = brief_dict(document_type)
|
||||
data["title"] = "기술적 선택을 설명하는 글"
|
||||
data["language"] = "ko-KR"
|
||||
data["language"] = language
|
||||
data["reader_goal"] = "안전한 구현 방식을 선택한다"
|
||||
data["core_message"] = "기술 선택은 문제와 비용을 함께 설명해야 한다."
|
||||
data["constraints"]["style_profile"] = "woowahan_tech_blog_ko"
|
||||
data["constraints"]["style_profile"] = style_profile
|
||||
return Brief.from_dict(data)
|
||||
|
||||
def test_korean_blog_prompts_separate_information_structure_from_sentence_form(self) -> None:
|
||||
brief = self._korean_blog()
|
||||
def _prompts(self, brief: Brief) -> tuple[str, str, str]:
|
||||
sources = make_sources()
|
||||
outline = create_outline(brief, sources)
|
||||
lint_report = LintReport(score=100.0, word_count=0, issues=[], metrics={})
|
||||
@@ -27,13 +32,40 @@ class PromptTests(unittest.TestCase):
|
||||
draft = drafting_prompt(brief, outline, sources)
|
||||
review = review_prompt(brief, outline, sources, "# draft", lint_report, "editor")
|
||||
revision = revision_prompt(brief, outline, sources, "# draft", lint_report, [])
|
||||
return draft, review, revision
|
||||
|
||||
self.assertIn("semantic order, never as a sentence template", draft)
|
||||
self.assertIn("첫 번째 제약은", draft)
|
||||
self.assertIn("Information-architecture labels must not leak", review)
|
||||
self.assertIn("real ordered sequences", review)
|
||||
self.assertIn("Remove repeated ordinal sentence scaffolding", revision)
|
||||
self.assertIn("real procedure, method, layer, or figure", revision)
|
||||
def test_korean_blog_prompts_share_experience_prose_contract(self) -> None:
|
||||
prompts = self._prompts(self._brief())
|
||||
|
||||
for prompt in prompts:
|
||||
with self.subTest(stage=prompt[:40]):
|
||||
self.assertIn("korean_first_person_experience_v1", 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("실제 관찰", prompts[1])
|
||||
self.assertIn("문서 전체", prompts[2])
|
||||
|
||||
def test_korean_readme_prompts_share_experience_prose_contract(self) -> None:
|
||||
prompts = self._prompts(self._brief("readme", style_profile="auto"))
|
||||
|
||||
for prompt in prompts:
|
||||
self.assertIn("korean_first_person_experience_v1", prompt)
|
||||
self.assertIn("저는", prompt)
|
||||
self.assertIn("했습니다", prompt)
|
||||
|
||||
def test_unrelated_document_types_do_not_receive_experience_contract(self) -> None:
|
||||
briefs = [
|
||||
self._brief(language="en-US"),
|
||||
self._brief("tutorial", style_profile="auto"),
|
||||
]
|
||||
|
||||
for brief in briefs:
|
||||
for prompt in self._prompts(brief):
|
||||
self.assertNotIn("korean_first_person_experience_v1", prompt)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user