diff options
author | Greg Ward <gward@python.net> | 2003-05-07 01:19:22 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2003-05-07 01:19:22 (GMT) |
commit | cc55cb95394469d8d250ffa810ab9f76881bffa1 (patch) | |
tree | a58f37115c3b6aa113859d98951835b4d2205a20 | |
parent | 21820cd92503cb7860fb22e61ccb3796f05e3cb6 (diff) | |
download | cpython-cc55cb95394469d8d250ffa810ab9f76881bffa1.zip cpython-cc55cb95394469d8d250ffa810ab9f76881bffa1.tar.gz cpython-cc55cb95394469d8d250ffa810ab9f76881bffa1.tar.bz2 |
SF #596434: add test_funky_parens() to probe some more of the tricky
edge cases that David Goodger reported long ago (July 2002?).
-rw-r--r-- | Lib/test/test_textwrap.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py index 0f7f567..74a88b9 100644 --- a/Lib/test/test_textwrap.py +++ b/Lib/test/test_textwrap.py @@ -224,11 +224,27 @@ What a mess! self.check_split("what the--.", ["what", " ", "the--."]) self.check_split("--text--.", ["--text--."]) - # My initial mis-interpretation of part of the bug report -- - # These were always handled correctly, but it can't hurt to make - # sure that they *stay* correct! + # When I first read bug #596434, this is what I thought David + # was talking about. I was wrong; these have always worked + # fine. The real problem is tested in test_funky_parens() + # below... self.check_split("--option", ["--option"]) self.check_split("--option-opt", ["--option-", "opt"]) + self.check_split("foo --option-opt bar", + ["foo", " ", "--option-", "opt", " ", "bar"]) + + def test_funky_parens (self): + # Second part of SF bug #596434: long option strings inside + # parentheses. + self.check_split("foo (--option) bar", + ["foo", " ", "(--option)", " ", "bar"]) + + # Related stuff -- make sure parens work in simpler contexts. + self.check_split("foo (bar) baz", + ["foo", " ", "(bar)", " ", "baz"]) + self.check_split("blah (ding dong), wubba", + ["blah", " ", "(ding", " ", "dong),", + " ", "wubba"]) def test_initial_whitespace(self): # SF bug #622849 reported inconsistent handling of leading |