summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2002-08-22 21:10:07 (GMT)
committerGreg Ward <gward@python.net>2002-08-22 21:10:07 (GMT)
commit34f995b3c17102c65dac184d8bce4ccff81a04a4 (patch)
tree2d8228b71e005af420687d9e195102cd8a4dbb76
parentcce4d67fc466b902a6b553c731d7be700b506dfd (diff)
downloadcpython-34f995b3c17102c65dac184d8bce4ccff81a04a4.zip
cpython-34f995b3c17102c65dac184d8bce4ccff81a04a4.tar.gz
cpython-34f995b3c17102c65dac184d8bce4ccff81a04a4.tar.bz2
Add test_unix_options() to WrapTestCase to test for SF bug #596434.
-rw-r--r--Lib/test/test_textwrap.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py
index a19e3ba..d6bd47c 100644
--- a/Lib/test/test_textwrap.py
+++ b/Lib/test/test_textwrap.py
@@ -163,6 +163,34 @@ What a mess!
"\nexpected %r\n"
"but got %r" % (expect, result))
+ def test_unix_options (self):
+ # Test that Unix-style command-line options are wrapped correctly.
+ # Both Optik (OptionParser) and Docutils rely on this behaviour!
+
+ text = "You should use the -n option, or --dry-run in its long form."
+ self.check_wrap(text, 20,
+ ["You should use the",
+ "-n option, or --dry-",
+ "run in its long",
+ "form."])
+ self.check_wrap(text, 21,
+ ["You should use the -n",
+ "option, or --dry-run",
+ "in its long form."])
+ expect = ["You should use the -n option, or",
+ "--dry-run in its long form."]
+ self.check_wrap(text, 32, expect)
+ self.check_wrap(text, 34, expect)
+ self.check_wrap(text, 35, expect)
+ self.check_wrap(text, 38, expect)
+ expect = ["You should use the -n option, or --dry-",
+ "run in its long form."]
+ self.check_wrap(text, 39, expect)
+ self.check_wrap(text, 41, expect)
+ expect = ["You should use the -n option, or --dry-run",
+ "in its long form."]
+ self.check_wrap(text, 42, expect)
+
def test_split(self):
# Ensure that the standard _split() method works as advertised
# in the comments