2 from __future__
import unicode_literals
5 from cola
import textwrap
8 class WordWrapTestCase(unittest
.TestCase
):
14 return textwrap
.word_wrap(text
, self
.tabwidth
, self
.limit
)
16 def test_word_wrap(self
):
19 12345678901 3 56 8 01 3 5 7
27 self
.assertEqual(expect
, self
.wrap(text
))
29 def test_word_wrap_dashes(self
):
33 self
.assertEqual(expect
, self
.wrap(text
))
35 def test_word_wrap_double_dashes(self
):
39 self
.assertEqual(expect
, self
.wrap(text
))
41 def test_word_wrap_many_lines(self
):
55 self
.assertEqual(expect
, self
.wrap(text
))
57 def test_word_python_code(self
):
66 self
.assertEqual(text
, self
.wrap(text
))
68 def test_word_wrap_spaces(self
):
71 self
.assertEqual(' ' * 6, self
.wrap(text
))
73 def test_word_wrap_special_tag(self
):
76 This test is so meta, even this sentence
78 Cheered-on-by: Avoids word-wrap
79 C.f. This also avoids word-wrap
80 References: This also avoids word-wrap
81 See-also: This also avoids word-wrap
82 Related-to: This also avoids word-wrap
83 Link: This also avoids word-wrap
96 Cheered-on-by: Avoids word-wrap
97 C.f. This also avoids word-wrap
98 References: This also avoids word-wrap
99 See-also: This also avoids word-wrap
100 Related-to: This also avoids word-wrap
101 Link: This also avoids word-wrap
104 self
.assertEqual(self
.wrap(text
), expect
)
106 def test_word_wrap_space_at_start_of_wrap(self
):
107 inputs
= """0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 """
108 expect
= """0 1 2 3 4 5 6 7 8 9\n0 1 2 3 4 5 6 7 8"""
110 actual
= self
.wrap(inputs
)
111 self
.assertEqual(expect
, actual
)
114 if __name__
== '__main__':