diff options
| author | 2020-06-26 03:22:30 -0400 | |
|---|---|---|
| committer | 2020-06-26 03:34:38 -0400 | |
| commit | 77ce4c88695ca748059a7076de88d5b42b37d5f5 (patch) | |
| tree | a98ca1ad4a2159a33407024d3a316c30f0a42df7 /tests | |
| parent | Correctly pass scale_to_size in LinePaginator.paginate() (diff) | |
In LinePaginator, truncate words that exceed scale_to_size
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bot/test_pagination.py | 12 | 
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/bot/test_pagination.py b/tests/bot/test_pagination.py index 74896f010..ce880d457 100644 --- a/tests/bot/test_pagination.py +++ b/tests/bot/test_pagination.py @@ -39,13 +39,11 @@ class LinePaginatorTests(TestCase):          self.paginator.add_line('z')          self.assertEqual(len(self.paginator._pages), 1) -    def test_add_line_raises_on_very_long_words(self): -        """`add_line` should raise if a single long word is added that exceeds `scale_to_size`. - -        Note: truncation is also a potential option, but this should not occur from normal usage. -        """ -        with self.assertRaises(RuntimeError): -            self.paginator.add_line('x' * (self.paginator.scale_to_size + 1)) +    def test_add_line_truncates_very_long_words(self): +        """`add_line` should truncate if a single long word exceeds `scale_to_size`.""" +        self.paginator.add_line('x' * (self.paginator.scale_to_size + 1)) +        # Note: item at index 1 is the truncated line, index 0 is prefix +        self.assertEqual(self.paginator._current_page[1], 'x' * self.paginator.scale_to_size)  class ImagePaginatorTests(TestCase):  |