Lines Matching defs:getopt

7 import getopt
22 self.assertRaises(getopt.GetoptError, *args, **kwargs)
25 self.assertTrue(getopt.short_has_arg('a', 'a:'))
26 self.assertFalse(getopt.short_has_arg('a', 'a'))
27 self.assertError(getopt.short_has_arg, 'a', 'b')
30 has_arg, option = getopt.long_has_args('abc', ['abc='])
34 has_arg, option = getopt.long_has_args('abc', ['abc'])
38 has_arg, option = getopt.long_has_args('abc', ['abcd'])
42 self.assertError(getopt.long_has_args, 'abc', ['def'])
43 self.assertError(getopt.long_has_args, 'abc', [])
44 self.assertError(getopt.long_has_args, 'abc', ['abcd','abcde'])
47 opts, args = getopt.do_shorts([], 'a', 'a', [])
51 opts, args = getopt.do_shorts([], 'a1', 'a:', [])
55 #opts, args = getopt.do_shorts([], 'a=1', 'a:', [])
59 opts, args = getopt.do_shorts([], 'a', 'a:', ['1'])
63 opts, args = getopt.do_shorts([], 'a', 'a:', ['1', '2'])
67 self.assertError(getopt.do_shorts, [], 'a1', 'a', [])
68 self.assertError(getopt.do_shorts, [], 'a', 'a:', [])
71 opts, args = getopt.do_longs([], 'abc', ['abc'], [])
75 opts, args = getopt.do_longs([], 'abc=1', ['abc='], [])
79 opts, args = getopt.do_longs([], 'abc=1', ['abcd='], [])
83 opts, args = getopt.do_longs([], 'abc', ['ab', 'abc', 'abcd'], [])
90 opts, args = getopt.do_longs([], 'foo=42', ['foo-bar', 'foo=',], [])
94 self.assertError(getopt.do_longs, [], 'abc=1', ['abc'], [])
95 self.assertError(getopt.do_longs, [], 'abc', ['abc='], [])
104 opts, args = getopt.getopt(cmdline, 'a:b', ['alpha=', 'beta'])
109 # accounted for in the code that calls getopt().
112 self.assertError(getopt.getopt, cmdline, 'a:b', ['alpha', 'beta'])
119 opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta='])
125 opts, args = getopt.gnu_getopt(['-a', '-', '-b', '-'], 'ab:', [])
130 opts, args = getopt.gnu_getopt(cmdline, '+ab:', ['alpha', 'beta='])
136 opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta='])
147 >>> import getopt
151 >>> optlist, args = getopt.getopt(args, 'abc:d:')
164 >>> optlist, args = getopt.getopt(args, 'x', [
177 longopts, shortopts = getopt.getopt(['--help='], '', ['help='])
179 longopts, shortopts = getopt.getopt(['--help=x'], '', ['help='])
181 self.assertRaises(getopt.GetoptError, getopt.getopt, ['--help='], '', ['help'])