(self)
| 76 | self.check_wrap("", 6, [], initial_indent="++", drop_whitespace=False) |
| 77 | |
| 78 | def test_whitespace(self): |
| 79 | # Whitespace munging and end-of-sentence detection |
| 80 | |
| 81 | text = """\ |
| 82 | This is a paragraph that already has |
| 83 | line breaks. But some of its lines are much longer than the others, |
| 84 | so it needs to be wrapped. |
| 85 | Some lines are \ttabbed too. |
| 86 | What a mess! |
| 87 | """ |
| 88 | |
| 89 | expect = ["This is a paragraph that already has line", |
| 90 | "breaks. But some of its lines are much", |
| 91 | "longer than the others, so it needs to be", |
| 92 | "wrapped. Some lines are tabbed too. What a", |
| 93 | "mess!"] |
| 94 | |
| 95 | wrapper = TextWrapper(45, fix_sentence_endings=True) |
| 96 | result = wrapper.wrap(text) |
| 97 | self.check(result, expect) |
| 98 | |
| 99 | result = wrapper.fill(text) |
| 100 | self.check(result, '\n'.join(expect)) |
| 101 | |
| 102 | text = "\tTest\tdefault\t\ttabsize." |
| 103 | expect = [" Test default tabsize."] |
| 104 | self.check_wrap(text, 80, expect) |
| 105 | |
| 106 | text = "\tTest\tcustom\t\ttabsize." |
| 107 | expect = [" Test custom tabsize."] |
| 108 | self.check_wrap(text, 80, expect, tabsize=4) |
| 109 | |
| 110 | def test_fix_sentence_endings(self): |
| 111 | wrapper = TextWrapper(60, fix_sentence_endings=True) |
nothing calls this directly
no test coverage detected