diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/helper_test.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/helper_test.py b/tests/helper_test.py index 62e37ed8..3e4c4766 100644 --- a/tests/helper_test.py +++ b/tests/helper_test.py @@ -402,3 +402,21 @@ class TestEmailAsString(unittest.TestCase): actual = helper.email_as_string(message) expected = 'X-Unicode-Header: dummy value\r\n\r\n' self.assertEqual(actual, expected) + + +class TestShorten(unittest.TestCase): + + def test_lt_maxlen(self): + expected = u'a string' + actual = helper.shorten(expected, 25) + self.assertEqual(expected, actual) + + def test_eq_maxlen(self): + expected = 'a string' + actual = helper.shorten(expected, len(expected)) + self.assertEqual(expected, actual) + + def test_gt_maxlen(self): + expected = u'a long string…' + actual = helper.shorten('a long string that is full of text', 14) + self.assertEqual(expected, actual) |