diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-02-07 17:09:25 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-08-22 12:25:03 -0700 |
commit | 9904d04f841c607c976cfc39571f167fd3d8d805 (patch) | |
tree | 5e05bcdbb82fb62fb2b9844ca128a5b643f241f5 /tests | |
parent | 052bd44cd92d79473717806487cbbe4ca3f34bd2 (diff) |
tests/helper_test.py: Add tests for helper.shorten
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) |