Files
ai-hell/tests/test_prompts.py

62 lines
1.9 KiB
Python

from server.prompts import (
get_image_prompt,
get_voice_text,
get_direct_address_text,
SEVERITY_TIERS,
)
class TestImagePrompts:
def test_low_severity_prompt(self):
"""Low severity returns abstract/atmospheric prompt."""
prompt = get_image_prompt(severity=0.5)
assert isinstance(prompt, str)
assert len(prompt) > 10
def test_high_severity_prompt(self):
"""High severity returns more extreme prompt."""
prompt = get_image_prompt(severity=4.0)
assert isinstance(prompt, str)
assert len(prompt) > 10
def test_prompts_vary(self):
"""Consecutive calls produce different prompts."""
prompts = [get_image_prompt(severity=2.0) for _ in range(10)]
assert len(set(prompts)) > 1
def test_severity_tiers_ordered(self):
"""Tier thresholds are in ascending order."""
thresholds = [t[0] for t in SEVERITY_TIERS]
assert thresholds == sorted(thresholds)
def test_negative_prompt_included(self):
"""Prompt includes SDXL negative prompt suffix."""
prompt = get_image_prompt(severity=1.0)
assert isinstance(prompt, str)
class TestVoiceTexts:
def test_whisper_text(self):
"""Get a whisper text fragment."""
text = get_voice_text()
assert isinstance(text, str)
assert len(text) > 0
def test_whisper_texts_vary(self):
"""Consecutive calls produce different texts."""
texts = [get_voice_text() for _ in range(20)]
assert len(set(texts)) > 1
class TestDirectAddress:
def test_direct_address_text(self):
"""Get a direct address phrase."""
text = get_direct_address_text()
assert isinstance(text, str)
assert len(text) > 0
def test_direct_address_texts_vary(self):
"""Consecutive calls produce different phrases."""
texts = [get_direct_address_text() for _ in range(20)]
assert len(set(texts)) > 1