Exemple #1
0
 def test_fill_with_breaks(self):
     # Demonstrate complicated case.
     text = u"spam ham egg spamhamegg" + _str_D + u" spam" + _str_D * 2
     self.assertEqual(
         u'\n'.join([
             "spam ham", "egg spam", "hamegg" + _str_D[0], _str_D[1:],
             "spam" + _str_D[:2], _str_D[2:] + _str_D[:2], _str_D[2:]
         ]), utextwrap.fill(text, 8))
Exemple #2
0
 def test_fill_with_breaks(self):
     # Demonstrate complicated case.
     text = u"spam ham egg spamhamegg" + _str_D + u" spam" + _str_D*2
     self.assertEqual(u'\n'.join(["spam ham",
                                  "egg spam",
                                  "hamegg" + _str_D[0],
                                  _str_D[1:],
                                  "spam" + _str_D[:2],
                                  _str_D[2:]+_str_D[:2],
                                  _str_D[2:]]),
                      utextwrap.fill(text, 8))
Exemple #3
0
 def test_fill_without_breaks(self):
     text = u"spam ham egg spamhamegg" + _str_D + u" spam" + _str_D*2
     self.assertEqual(u'\n'.join(["spam ham",
                                  "egg",
                                  "spamhamegg", 
                                  # border between single width and double
                                  # width.
                                  _str_D,
                                  "spam" + _str_D[:2],
                                  _str_D[2:]+_str_D[:2],
                                  _str_D[2:]]),
                      utextwrap.fill(text, 8, break_long_words=False))
Exemple #4
0
 def test_fill_without_breaks(self):
     text = u"spam ham egg spamhamegg" + _str_D + u" spam" + _str_D * 2
     self.assertEqual(
         u'\n'.join([
             "spam ham",
             "egg",
             "spamhamegg",
             # border between single width and double
             # width.
             _str_D,
             "spam" + _str_D[:2],
             _str_D[2:] + _str_D[:2],
             _str_D[2:]
         ]),
         utextwrap.fill(text, 8, break_long_words=False))
Exemple #5
0
 def test_fill_simple(self):
     # Test only can call fill() because it's just '\n'.join(wrap(text)).
     self.assertEqual("%s\n%s" % (_str_D[:2], _str_D[2:]),
                      utextwrap.fill(_str_D, 4))
Exemple #6
0
 def test_fill_simple(self):
     # Test only can call fill() because it's just '\n'.join(wrap(text)).
     self.assertEqual("%s\n%s" % (_str_D[:2], _str_D[2:]),
                      utextwrap.fill(_str_D, 4))