import re from pathlib import Path PROMPT = Path("default_system_prompt.md").read_text(encoding="utf-8") def test_mandatory_qna_section_present(): assert "MANDATORY QUESTION HANDLING" in PROMPT, "Missing MANDATORY QUESTION HANDLING section" def test_reminder_templates_present(): assert "Gentle Reminder" in PROMPT assert "Firm Reminder" in PROMPT assert "Final prompt" in PROMPT def test_skip_keywords_present(): # check for both English and Russian skip examples for kw in ["skip", "пропустить", "не хочу отвечать", "I don't want to answer"]: assert kw in PROMPT, f"skip/refusal keyword {kw!r} not present in prompt" def test_templates_short(): # ensure templates are concise — no more than 30 words in each template template_pattern = re.compile( r'-\s*(Gentle Reminder|Firm Reminder|Final prompt).*?:\s*"([^"]+)"', flags=re.S ) matches = template_pattern.findall(PROMPT) assert matches, "No templates found by regex" for name, text in matches: words = text.split() assert len(words) <= 40, f"{name} template is too long ({len(words)} words)"