mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
#2659: add `break_on_hyphens` to TextWrapper.
This commit is contained in:
parent
5b54887deb
commit
6f95ae55b1
4 changed files with 48 additions and 3 deletions
|
|
@ -364,6 +364,14 @@ def test_split(self):
|
|||
["Hello", " ", "there", " ", "--", " ", "you", " ", "goof-",
|
||||
"ball,", " ", "use", " ", "the", " ", "-b", " ", "option!"])
|
||||
|
||||
def test_break_on_hyphens(self):
|
||||
# Ensure that the break_on_hyphens attributes work
|
||||
text = "yaba daba-doo"
|
||||
self.check_wrap(text, 10, ["yaba daba-", "doo"],
|
||||
break_on_hyphens=True)
|
||||
self.check_wrap(text, 10, ["yaba", "daba-doo"],
|
||||
break_on_hyphens=False)
|
||||
|
||||
def test_bad_width(self):
|
||||
# Ensure that width <= 0 is caught.
|
||||
text = "Whatever, it doesn't matter."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue