summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2002-12-09 16:27:15 (GMT)
committerGreg Ward <gward@python.net>2002-12-09 16:27:15 (GMT)
commit24cbbcb57fddc3e0edcd7e9bdb02f368f0913dc0 (patch)
tree688d811e68a67cbdd31f03b2f4320c485a331b4a
parentab73d46e45eae94fb8be040ccb32d3510b8f58fa (diff)
downloadcpython-24cbbcb57fddc3e0edcd7e9bdb02f368f0913dc0.zip
cpython-24cbbcb57fddc3e0edcd7e9bdb02f368f0913dc0.tar.gz
cpython-24cbbcb57fddc3e0edcd7e9bdb02f368f0913dc0.tar.bz2
Added test_initial_whitespace() to ensure that SF bug #622849 is fixed.
Change LongWordTestCase.setUp() -- remove leading whitespace from text string. Comment fix.
-rw-r--r--Lib/test/test_textwrap.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py
index 4a98972..d164d75 100644
--- a/Lib/test/test_textwrap.py
+++ b/Lib/test/test_textwrap.py
@@ -224,11 +224,21 @@ What a mess!
self.check_split("what the--.", ["what", " ", "the--."])
self.check_split("--text--.", ["--text--."])
- # I think David got this wrong in the bug report, but it can't
- # hurt to make sure it stays right!
+ # 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!
self.check_split("--option", ["--option"])
self.check_split("--option-opt", ["--option-", "opt"])
+ def test_initial_whitespace(self):
+ # SF bug #622849 reported inconsistent handling of leading
+ # whitespace; let's test that a bit, shall we?
+ text = " This is a sentence with leading whitespace."
+ self.check_wrap(text, 50,
+ [" This is a sentence with leading whitespace."])
+ self.check_wrap(text, 30,
+ [" This is a sentence with", "leading whitespace."])
+
def test_split(self):
# Ensure that the standard _split() method works as advertised
# in the comments
@@ -244,7 +254,7 @@ What a mess!
class LongWordTestCase (BaseTestCase):
def setUp(self):
self.wrapper = TextWrapper()
- self.text = '''
+ self.text = '''\
Did you say "supercalifragilisticexpialidocious?"
How *do* you spell that odd word, anyways?
'''