#2659: add `break_on_hyphens` to TextWrapper.

This commit is contained in:
Georg Brandl 2008-05-11 10:42:28 +00:00
parent 5b54887deb
commit 6f95ae55b1
4 changed files with 48 additions and 3 deletions

View file

@ -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."