1 from bup import options
11 d['no_other_thing'] = 5
15 WVPASSEQ(d.no_z, False)
16 WVPASSEQ(d.no_other_thing, True)
20 WVPASS("invalid args don't match")
22 WVFAIL("exception expected")
26 prog <optionset> [stuff...]
31 l,longoption= long option with parameters and a really really long description that will require wrapping
32 p= short option with parameters
33 onlylong long option with no short
34 neveropt never called options
35 deftest1= a default option with default [1]
36 deftest2= a default option with [1] default [2]
37 deftest3= a default option with [3] no actual default
38 deftest4= a default option with [[square]]
39 deftest5= a default option with "correct" [[square]
40 no-stupid disable stupidity
45 o = options.Options(optspec)
46 (opt,flags,extra) = o.parse(['-tttqp', 7, '--longoption', '19',
47 'hanky', '--onlylong'])
48 WVPASSEQ(flags[0], ('-t', ''))
49 WVPASSEQ(flags[1], ('-t', ''))
50 WVPASSEQ(flags[2], ('-t', ''))
51 WVPASSEQ(flags[3], ('-q', ''))
52 WVPASSEQ(flags[4], ('-p', 7))
53 WVPASSEQ(flags[5], ('--longoption', '19'))
54 WVPASSEQ(extra, ['hanky'])
55 WVPASSEQ((opt.t, opt.q, opt.p, opt.l, opt.onlylong,
56 opt.neveropt), (3,1,7,19,1,None))
57 WVPASSEQ((opt.deftest1, opt.deftest2, opt.deftest3, opt.deftest4,
58 opt.deftest5), (1,2,None,None,'[square'))
59 WVPASSEQ((opt.stupid, opt.no_stupid), (True, False))
60 (opt,flags,extra) = o.parse(['--onlylong', '-t', '--no-onlylong'])
61 WVPASSEQ((opt.t, opt.q, opt.onlylong), (1, None, 0))