35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""Тесты сборки приветствия: подпись к фото + одно общее сообщение."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from common.texts.welcome import split_welcome
|
|
|
|
|
|
def test_first_line_is_caption_rest_joins_body() -> None:
|
|
caption, body = split_welcome(
|
|
"💠{username}, добро пожаловать в Dispel Evil!\n\n❗️Правила клана\n1. …",
|
|
"Часть 2",
|
|
"Часть 3",
|
|
)
|
|
|
|
assert caption == "💠{username}, добро пожаловать в Dispel Evil!"
|
|
assert body == "❗️Правила клана\n1. …\n\nЧасть 2\n\nЧасть 3"
|
|
|
|
|
|
def test_without_newline_all_text_is_caption() -> None:
|
|
caption, body = split_welcome("Привет", "Второй", "Третий")
|
|
|
|
assert caption == "Привет"
|
|
assert body == "Второй\n\nТретий"
|
|
|
|
|
|
def test_empty_parts_are_skipped() -> None:
|
|
caption, body = split_welcome("Привет\n\nТело", "", " ")
|
|
|
|
assert caption == "Привет"
|
|
assert body == "Тело"
|
|
|
|
|
|
def test_no_parts() -> None:
|
|
assert split_welcome() == ("", "")
|