mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-30591: Added test for textwrap backtracking. (#1988)
This commit is contained in:
parent
6f46683a62
commit
5edf827c80
1 changed files with 11 additions and 0 deletions
|
@ -559,6 +559,17 @@ class MaxLinesTestCase(BaseTestCase):
|
||||||
placeholder=' [truncated]...')
|
placeholder=' [truncated]...')
|
||||||
self.check_wrap(self.text, 80, [self.text], placeholder='.' * 1000)
|
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):
|
class LongWordTestCase (BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue