diff Lib/test/test_getopt.py @ 50079:a86cdf49b821 3.0

Manual merge of r67639 from py3k branch: Merged revisions 67463,67572,67576,67628 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ......... r67463 | skip.montanaro | 2008-12-01 02:55:22 +0100 (Mon, 01 Dec 2008) | 1 line typo in comment ......... r67572 | georg.brandl | 2008-12-05 10:23:14 +0100 (Fri, 05 Dec 2008) | 2 lines #4458: recognize "-" as an argument, not a malformed option in gnu_getopt(). ......... r67576 | georg.brandl | 2008-12-05 13:09:41 +0100 (Fri, 05 Dec 2008) | 2 lines #4529: fix parser's validation for try-except-finally statements. ......... r67628 | skip.montanaro | 2008-12-07 03:16:00 +0100 (Sun, 07 Dec 2008) | 1 line muffed the default case .........
author Georg Brandl <georg@python.org>
date Sun, 07 Dec 2008 16:04:03 +0000
parents 9c930a32cebb
children 5c55b9c80846
line wrap: on
line diff
--- a/Lib/test/test_getopt.py	Sun Dec 07 16:02:32 2008 +0000
+++ b/Lib/test/test_getopt.py	Sun Dec 07 16:04:03 2008 +0000
@@ -124,6 +124,11 @@
         self.assertEqual(opts, [('-a', ''), ('-b', '1'),
                                 ('--alpha', ''), ('--beta', '2')])
 
+        # recognize "-" as an argument
+        opts, args = getopt.gnu_getopt(['-a', '-', '-b', '-'], 'ab:', [])
+        self.assertEqual(args, ['-'])
+        self.assertEqual(opts, [('-a', ''), ('-b', '-')])
+
         # Posix style via +
         opts, args = getopt.gnu_getopt(cmdline, '+ab:', ['alpha', 'beta='])
         self.assertEqual(opts, [('-a', '')])