22 lines
764 B
Python
22 lines
764 B
Python
"""小周天反思 prompt 构建纯函数测试。"""
|
|
|
|
from app.modules.reflection.prompts import build_reflection_messages
|
|
|
|
|
|
def test_messages_return_system_user_pair() -> None:
|
|
system, user = build_reflection_messages("你好", "你好,我是魂镜")
|
|
assert isinstance(system, str) and isinstance(user, str)
|
|
assert system and user
|
|
|
|
|
|
def test_system_describes_memories_and_reflection() -> None:
|
|
system, _ = build_reflection_messages("u", "a")
|
|
for token in ("memories", "reflection", "importance", "sensitivity"):
|
|
assert token in system
|
|
|
|
|
|
def test_user_includes_dialogue() -> None:
|
|
_, user = build_reflection_messages("用户说的话", "助手的回复")
|
|
assert "用户说的话" in user
|
|
assert "助手的回复" in user
|