4 from cola
import textwrap
7 class WordWrapTestCase(unittest
.TestCase
):
13 return textwrap
.word_wrap(text
, self
.tabwidth
, self
.limit
)
15 def test_word_wrap(self
):
18 12345678901 3 56 8 01 3 5 7
26 self
.assertEqual(expect
, self
.wrap(text
))
28 def test_word_wrap_dashes(self
):
32 self
.assertEqual(expect
, self
.wrap(text
))
34 def test_word_wrap_double_dashes(self
):
38 self
.assertEqual(expect
, self
.wrap(text
))
40 def test_word_wrap_many_lines(self
):
54 self
.assertEqual(expect
, self
.wrap(text
))
56 def test_word_python_code(self
):
65 self
.assertEqual(text
, self
.wrap(text
))
67 def test_word_wrap_spaces(self
):
70 self
.assertEqual(' ' * 6, self
.wrap(text
))
72 def test_word_wrap_special_tag(self
):
75 This test is so meta, even this sentence
77 With-special-tag: Avoids word-wrap
90 With-special-tag: Avoids word-wrap
93 self
.assertEqual(self
.wrap(text
), expect
)
95 def test_word_wrap_space_at_start_of_wrap(self
):
96 inputs
= """0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 """
97 expect
= """0 1 2 3 4 5 6 7 8 9\n0 1 2 3 4 5 6 7 8"""
99 actual
= self
.wrap(inputs
)
100 self
.assertEqual(expect
, actual
)
103 if __name__
== '__main__':