initial commit heh

This commit is contained in:
timka123 committed 2026-11-07 22:34:12 +03:00
commit 5eea9d0f2c
78 files changed
+11181

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
"""Unit tests for Telegram formatting and message splitting."""
from homeagent.bot.utils import split_message
def test_split_short_message():
text = "Short message"
assert split_message(text, max_length=100) == ["Short message"]
def test_split_long_message_preserves_code_blocks():
code = "```python\n" + "\n".join([f"x_{i} = {i}" for i in range(50)]) + "\n```"
chunks = split_message(code, max_length=150)
assert len(chunks) > 1
# First chunk should have closed code block
assert chunks[0].strip().endswith("```")
# Second chunk should have reopened code block
assert chunks[1].strip().startswith("```python")