aether-garden / tests /test_generation.py
kavyabhand's picture
Deploy Aether Garden application
781b9f7 verified
Raw
History Blame Contribute Delete
1.23 kB
"""Tests for entity generation validation."""
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
os.environ.setdefault("USE_MOCK_AI", "true")
from ai.generation import EntityProfile, validate_input, _clean_name
def test_validate_input_min_words():
ok, msg = validate_input("too short")
assert not ok
assert "5 words" in msg
def test_validate_input_ok():
ok, _ = validate_input("a blind cartographer who maps impossible places")
assert ok
def test_clean_name_fixes_the_the():
assert _clean_name("The The Clockmaker", "x").startswith("The Clockmaker")
def test_entity_profile_traits():
data = {
"name": "The Silent Gear",
"display_name": "Silent Gear",
"type": "object",
"appearance": "A gear.",
"backstory": "It fell.",
"personality_traits": ["a", "b", "c", "d"],
"primary_goal": "Tick once.",
"secondary_goal": "Never tick.",
"primary_fear": "Being wound.",
"speech_style": "Metallic.",
"greeting": "Click.",
"suggested_location": "The Clock Forest",
"arrival_note": "It arrived.",
}
p = EntityProfile(**data)
assert p.name == "The Silent Gear"