1
0
libpurple-to-markdown/test/test_markdown_format.py

33 lines
582 B
Python
Raw Permalink Normal View History

2024-11-03 22:49:35 +00:00
import datetime
from libpurple_to_markdown.data import Message
2024-11-03 22:58:40 +00:00
from libpurple_to_markdown.markdown import format_messages
2024-11-03 22:49:35 +00:00
NOW = datetime.datetime.fromtimestamp(1_000_000_000, tz=datetime.UTC)
TEXT_1 = 'Hello \n \nWorld \n '
2024-11-03 22:49:35 +00:00
2024-11-03 22:58:40 +00:00
EXPECTED_1 = """# Test
2024-11-03 22:49:35 +00:00
---
## [[2001-09-09]]
2001-09-09 01:46:40 [[Test Sender]]:
> Hello
>
2024-11-03 22:49:35 +00:00
> World
2001-09-09 01:46:40 [[Test Sender]]:
> Hello
>
2024-11-03 22:49:35 +00:00
> World
2024-11-03 22:58:40 +00:00
"""
2024-11-03 22:49:35 +00:00
def test_whitespace_at_end_of_line():
msg = Message(NOW, 'Test Sender', TEXT_1, 'Test Chat')
result = format_messages([msg, msg], title='Test')
assert result == EXPECTED_1