MpakoImageAIbot/tests/test_context.py

29 lines
806 B
Python

from __future__ import annotations
from bot import format_context
from db import UserContext
def test_format_context_empty() -> None:
text = format_context(None)
assert "Контекст пуст" in text
def test_format_context_shows_prompt_and_reset_hint() -> None:
context = UserContext(
user_id=1,
base_prompt="A red apple on a table",
current_prompt="A blue apple on a table",
last_request_id=42,
last_mode="t2i",
updated_at="2026-10-19T12:00:00+00:00",
)
text = format_context(context)
assert "A blue apple on a table" in text
assert "A red apple on a table" in text
assert "Последний запрос: #42 (t2i)" in text
assert "Обновлён: 19.10.2026 15:00" in text
assert "/restart" in text