diff options
author | Greg Ward <gward@python.net> | 2005-03-05 02:38:33 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2005-03-05 02:38:33 (GMT) |
commit | c1d3096affe0ab021fb97f0c401abc1542c6a05b (patch) | |
tree | 6ba194eef963cee018c1a53e115fbcc6fc4d9522 /Lib/test | |
parent | dce2f3605bc56187d1b8af83920d1a210443ec70 (diff) | |
download | cpython-c1d3096affe0ab021fb97f0c401abc1542c6a05b.zip cpython-c1d3096affe0ab021fb97f0c401abc1542c6a05b.tar.gz cpython-c1d3096affe0ab021fb97f0c401abc1542c6a05b.tar.bz2 |
SF #1149508: ensure textwrap handles hyphenated numbers correctly,
eg. "2004-03-04" is not broken across lines.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_textwrap.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py index 17fd1cf..a21b7ce 100644 --- a/Lib/test/test_textwrap.py +++ b/Lib/test/test_textwrap.py @@ -165,6 +165,24 @@ What a mess! ["this-is-a-useful-feature-for-reformatting-", "posts-from-tim-peters'ly"]) + def test_hyphenated_numbers(self): + # Test that hyphenated numbers (eg. dates) are not broken like words. + text = ("Python 1.0.0 was released on 1994-01-26. Python 1.0.1 was\n" + "released on 1994-02-15.") + + self.check_wrap(text, 30, ['Python 1.0.0 was released on', + '1994-01-26. Python 1.0.1 was', + 'released on 1994-02-15.']) + self.check_wrap(text, 40, ['Python 1.0.0 was released on 1994-01-26.', + 'Python 1.0.1 was released on 1994-02-15.']) + + text = "I do all my shopping at 7-11." + self.check_wrap(text, 25, ["I do all my shopping at", + "7-11."]) + self.check_wrap(text, 27, ["I do all my shopping at", + "7-11."]) + self.check_wrap(text, 29, ["I do all my shopping at 7-11."]) + def test_em_dash(self): # Test text with em-dashes text = "Em-dashes should be written -- thus." |