mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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).
This commit is contained in:
parent
a565874cc1
commit
eccc5facd3
3 changed files with 11 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue