From da7bf4e236c674a4f0a5dcbdaed426b7e5d5f4e4 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Wed, 27 Dec 2000 08:03:20 +0000 Subject: Add test case for SF bug https://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470 --- Lib/test/test_getopt.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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='], [])", -- cgit v0.12