Edm0nd/edmond/plugins/tests/test_wikipedia.py
dece 146db88ed3 wikipedia: fix messages too long
For now it's only used by the Wikipedia plugin but it should probably be
moved elsewhere quickly!
2022-11-25 01:25:54 +01:00

15 lines
554 B
Python

import unittest
from ..wikipedia import WikipediaPlugin
class TestWikipediaPlugin(unittest.TestCase):
def test_limit_text_length(self):
text = "lorem ipsum blah blah."
result = WikipediaPlugin.limit_text_length(text, max_length=10)
self.assertEqual(result, "lorem…")
result = WikipediaPlugin.limit_text_length(text, max_length=15)
self.assertEqual(result, "lorem ipsum…")
result = WikipediaPlugin.limit_text_length(text, max_length=30)
self.assertEqual(result, "lorem ipsum blah blah.")