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
41 #,compress= set compression level [5]
46 o = options.Options(optspec)
47 (opt,flags,extra) = o.parse(['-tttqp', 7, '--longoption', '19',
48 'hanky', '--onlylong', '-7'])
49 WVPASSEQ(flags[0], ('-t', ''))
50 WVPASSEQ(flags[1], ('-t', ''))
51 WVPASSEQ(flags[2], ('-t', ''))
52 WVPASSEQ(flags[3], ('-q', ''))
53 WVPASSEQ(flags[4], ('-p', 7))
54 WVPASSEQ(flags[5], ('--longoption', '19'))
55 WVPASSEQ(extra, ['hanky'])
56 WVPASSEQ((opt.t, opt.q, opt.p, opt.l, opt.onlylong,
57 opt.neveropt), (3,1,7,19,1,None))
58 WVPASSEQ((opt.deftest1, opt.deftest2, opt.deftest3, opt.deftest4,
59 opt.deftest5), (1,2,None,None,'[square'))
60 WVPASSEQ((opt.stupid, opt.no_stupid), (True, False))
62 WVPASSEQ(opt.compress, 7)
64 (opt,flags,extra) = o.parse(['--onlylong', '-t', '--no-onlylong'])
65 WVPASSEQ((opt.t, opt.q, opt.onlylong), (1, None, 0))