20 lines
580 B
Python
20 lines
580 B
Python
from __future__ import annotations
|
|
|
|
from bot import RESTART_HINT, result_caption
|
|
|
|
|
|
def test_result_caption_contains_prompt_and_restart_hint() -> None:
|
|
caption = result_caption("A red apple on a table")
|
|
assert caption == f"A red apple on a table\n\n{RESTART_HINT}"
|
|
|
|
|
|
def test_result_caption_truncates_long_prompt() -> None:
|
|
caption = result_caption("x" * 2000, limit=100)
|
|
assert len(caption) <= 100
|
|
assert caption.endswith(RESTART_HINT)
|
|
assert "…" in caption
|
|
|
|
|
|
def test_result_caption_empty_prompt() -> None:
|
|
assert result_caption("") == RESTART_HINT
|