Example #1
0
 def test_fill_indent_with_breaks(self):
     w = utextwrap.UTextWrapper(8,
                                initial_indent=' ' * 4,
                                subsequent_indent=' ' * 4)
     self.assertEqual(
         u'\n'.join([
             "    hell", "    o" + _str_D[0], "    " + _str_D[1:3],
             "    " + _str_D[3]
         ]), w.fill(_str_SD))
Example #2
0
 def test_fill_indent_without_breaks(self):
     w = utextwrap.UTextWrapper(8,
                                initial_indent=' ' * 4,
                                subsequent_indent=' ' * 4)
     w.break_long_words = False
     self.assertEqual(
         u'\n'.join([
             "    hello",
             "    " + _str_D[:2],
             "    " + _str_D[2:],
         ]), w.fill(_str_SD))
Example #3
0
 def test_split(self):
     w = utextwrap.UTextWrapper()
     self.assertEqual(list(_str_D), w._split(_str_D))
     self.assertEqual([_str_S] + list(_str_D), w._split(_str_SD))
     self.assertEqual(list(_str_D) + [_str_S], w._split(_str_DS))
Example #4
0
 def check_cut(self, text, width, pos):
     w = utextwrap.UTextWrapper()
     self.assertEqual((text[:pos], text[pos:]), w._cut(text, width))
Example #5
0
 def check_width(self, text, expected_width):
     w = utextwrap.UTextWrapper()
     self.assertEqual(w._width(text), expected_width,
                      "Width of %r should be %d" % (text, expected_width))
Example #6
0
 def test_ambiwidth2(self):
     w = utextwrap.UTextWrapper(4, ambiguous_width=2)
     s = self._cyrill_char * 8
     self.assertEqual([self._cyrill_char * 2] * 4, w.wrap(s))