Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Lib/test/test_textwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,17 @@ def test_placeholder(self):
placeholder=' [truncated]...')
self.check_wrap(self.text, 80, [self.text], placeholder='.' * 1000)

def test_placeholder_backtrack(self):
# Test special case when max_lines insufficient, but what
# would be last wrapped line so long the placeholder cannot
# be added there without violence. So, textwrap backtracks,
# adding placeholder to the penultimate line.
text = 'Good grief Python features are advancing quickly!'
self.check_wrap(text, 12,
['Good grief', 'Python*****'],
max_lines=3,
placeholder='*****')


class LongWordTestCase (BaseTestCase):
def setUp(self):
Expand Down