summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_getopt.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-07-24 01:07:52 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-07-24 01:07:52 (GMT)
commit4c16d122c42494ac735d5417cd79c70d67d341e0 (patch)
treed4a49da5dab7ac966e43dedca96a834dfe92cb0b /Lib/test/test_getopt.py
parentcdbd099ca0f3053bfa1c007e0d194862f0619510 (diff)
downloadcpython-4c16d122c42494ac735d5417cd79c70d67d341e0.zip
cpython-4c16d122c42494ac735d5417cd79c70d67d341e0.tar.gz
cpython-4c16d122c42494ac735d5417cd79c70d67d341e0.tar.bz2
Merged revisions 83116 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83116 | victor.stinner | 2010-07-24 02:49:20 +0200 (sam., 24 juil. 2010) | 4 lines Issue #4629: getopt raises an error if an argument ends with = whereas getopt doesn't except a value (eg. --help= is rejected if getopt uses ['help='] long options). ........
Diffstat (limited to 'Lib/test/test_getopt.py')
-rw-r--r--Lib/test/test_getopt.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_getopt.py b/Lib/test/test_getopt.py
index 6b18d9f..7186c7f 100644
--- a/Lib/test/test_getopt.py
+++ b/Lib/test/test_getopt.py
@@ -173,6 +173,12 @@ class GetoptTests(unittest.TestCase):
m = types.ModuleType("libreftest", s)
run_doctest(m, verbose)
+ def test_issue4629(self):
+ longopts, shortopts = getopt.getopt(['--help='], '', ['help='])
+ self.assertEquals(longopts, [('--help', '')])
+ longopts, shortopts = getopt.getopt(['--help=x'], '', ['help='])
+ self.assertEquals(longopts, [('--help', 'x')])
+ self.assertRaises(getopt.GetoptError, getopt.getopt, ['--help='], '', ['help'])
def test_main():
run_unittest(GetoptTests)