summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_getopt.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2000-12-27 08:03:20 (GMT)
committerTim Peters <tim.peters@gmail.com>2000-12-27 08:03:20 (GMT)
commitda7bf4e236c674a4f0a5dcbdaed426b7e5d5f4e4 (patch)
tree0f70afff12472ca094aee04ee5027e55d263ed3e /Lib/test/test_getopt.py
parentbe0630282efcce4f0554100b680bbfa82e5b6809 (diff)
downloadcpython-da7bf4e236c674a4f0a5dcbdaed426b7e5d5f4e4.zip
cpython-da7bf4e236c674a4f0a5dcbdaed426b7e5d5f4e4.tar.gz
cpython-da7bf4e236c674a4f0a5dcbdaed426b7e5d5f4e4.tar.bz2
Add test case for SF bug
https://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470
Diffstat (limited to 'Lib/test/test_getopt.py')
-rw-r--r--Lib/test/test_getopt.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_getopt.py b/Lib/test/test_getopt.py
index 3927c1c..1460200 100644
--- a/Lib/test/test_getopt.py
+++ b/Lib/test/test_getopt.py
@@ -74,6 +74,15 @@ assert args == []
opts, args = getopt.do_longs([], 'abc=1', ['abcd='], [])
assert opts == [('--abcd', '1')]
assert args == []
+opts, args = getopt.do_longs([], 'abc', ['ab', 'abc', 'abcd'], [])
+assert opts == [('--abc', '')]
+assert args == []
+# Much like the preceding, except with a non-alpha character ("-") in
+# option name that precedes "="; failed in
+# http://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470
+opts, args = getopt.do_longs([], 'foo=42', ['foo-bar', 'foo=',], [])
+assert opts == [('--foo', '42')]
+assert args == []
expectException("opts, args = getopt.do_longs([], 'abc=1', ['abc'], [])",
GetoptError)
expectException("opts, args = getopt.do_longs([], 'abc', ['abc='], [])",