summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_optparse.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-01-09 21:18:41 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-01-09 21:18:41 (GMT)
commit123e6d5b4b17e182cfa49b0913bfc0b77ecb2585 (patch)
treeb172af053a1970f2530d1771f81b97b1430d4d5d /Lib/test/test_optparse.py
parentba44860c118f375c81db1f82ac4714992a37a22e (diff)
parentf451112413b9ea8940c8c3a902cddf701c62d17f (diff)
downloadcpython-123e6d5b4b17e182cfa49b0913bfc0b77ecb2585.zip
cpython-123e6d5b4b17e182cfa49b0913bfc0b77ecb2585.tar.gz
cpython-123e6d5b4b17e182cfa49b0913bfc0b77ecb2585.tar.bz2
Issue #13107: argparse and optparse no longer raises an exception when output
a help on environment with too small COLUMNS. Based on patch by Elazar Gershuni.
Diffstat (limited to 'Lib/test/test_optparse.py')
-rw-r--r--Lib/test/test_optparse.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py
index 9473011..3c8c612 100644
--- a/Lib/test/test_optparse.py
+++ b/Lib/test/test_optparse.py
@@ -1443,6 +1443,39 @@ Options:
-h, --help show this help message and exit
"""
+_expected_very_help_short_lines = """\
+Usage: bar.py [options]
+
+Options:
+ -a APPLE
+ throw
+ APPLEs at
+ basket
+ -b NUM, --boo=NUM
+ shout
+ "boo!" NUM
+ times (in
+ order to
+ frighten
+ away all
+ the evil
+ spirits
+ that cause
+ trouble and
+ mayhem)
+ --foo=FOO
+ store FOO
+ in the foo
+ list for
+ later
+ fooing
+ -h, --help
+ show this
+ help
+ message and
+ exit
+"""
+
class TestHelp(BaseTest):
def setUp(self):
self.parser = self.make_parser(80)
@@ -1500,6 +1533,8 @@ class TestHelp(BaseTest):
# we look at $COLUMNS.
self.parser = self.make_parser(60)
self.assertHelpEquals(_expected_help_short_lines)
+ self.parser = self.make_parser(0)
+ self.assertHelpEquals(_expected_very_help_short_lines)
def test_help_unicode(self):
self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE)