summaryrefslogtreecommitdiff
path: root/Lib/test/test_getopt.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-07-24 00:49:20 +0000
committerVictor Stinner <victor.stinner@haypocalc.com>2010-07-24 00:49:20 +0000
commiteccc5facd34609c029efce6fd2cd302f73e50566 (patch)
tree4af5f6eb27248a69da350aaa0c27f136f5666b84 /Lib/test/test_getopt.py
parenta565874cc1a00e19716e537675adad46c00a7531 (diff)
downloadcpython-git-eccc5facd34609c029efce6fd2cd302f73e50566.tar.gz
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 13e1980251..a265b6b08a 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)