python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_optparse.cpython-312.opt-1.pyc

Αe:ddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlZddlmZm
Z
mZmZmZmZmZmZmZmZmZddlmZddlmZGdd	eZGd
deZGdd
ej8ZGddeZGddeZGddeZ GddeZ!dddddZ"dZ#Gdde
Z$GddeZ%Gd d!eZ&Gd"d#eZ'Gd$d%eZ(Gd&d'eZ)Gd(d)eZ*Gd*d+eZ+Gd,d-eZ,Gd.d/eZ-Gd0d1eZ.Gd2d3eZ/Gd4d5eZ0Gd6d7eZ1Gd8d9eZ2Gd:d;eZ3Gd<d=eZ4Gd>d?eZ5Gd@dAeZ6GdBdCeZ7GdDdEeZ8GdFdGeZ9GdHdIe9Z:GdJdKe9Z;GdLdMeZ<dNZ=dOZ>dPZ?dQZ@dRZAGdSdTeZBGdUdVeZCGdWdXeZDGdYdZej8ZEeFd[k(rejyy)\N)StringIO)support)	os_helper)make_optionOptionTitledHelpFormatterOptionParserOptionGroupSUPPRESS_USAGEOptionErrorOptionConflictErrorBadOptionErrorOptionValueErrorValues)
_match_abbrev)
_parse_numc eZdZ			ddZdZy)InterceptedErrorNc.||_||_||_yN)
error_messageexit_statusexit_message)selfrrrs    F/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_optparse.py__init__zInterceptedError.__init__s+&(c>|jxs|jxsdS)Nzintercepted error)rrrs r__str__zInterceptedError.__str__%s!!MT%6%6M:MMr)NNN)__name__
__module____qualname__rr rrrrs#!")NrrceZdZddZdZy)InterceptingOptionParserNct||)N)rrr)rstatusmsgs   rexitzInterceptingOptionParser.exit)s6DDrct|)N)rr()rr*s  rerrorzInterceptingOptionParser.error,s
S11rrN)r!r"r#r+r-r$rrr&r&(s
E2rr&c6eZdZdZdZdZ		ddZdZdZy)	BaseTestc|jj|\}}t|}|j||dt	z|j||dt	z||fS)aAssert the options are what we expected when parsing arguments.

        Otherwise, fail with a nicely formatted message.

        Keyword arguments:
        args -- A list of arguments to parse with OptionParser.
        expected_opts -- The options expected.
        expected_positional_args -- The positional arguments expected.

        Returns the options and positional args for further testing.
        zJ
Options are %(optdict)s.
Should be %(expected_opts)s.
Args were %(args)s.zj
Positional arguments are %(positional_args)s.
Should be %(expected_positional_args)s.
Args were %(args)s.)parser
parse_argsvarsassertEquallocals)rargs
expected_optsexpected_positional_argsoptionspositional_argsoptdicts       r
assertParseOKzBaseTest.assertParseOK1s|&*[[%;%;D%A"/w-- "	#	
*B #	$))rc
j|d}|i}	||i||jdtzy#|$r~}t|}t|tj
r3|j
|j|d|jd|dn|j||d|d|d|cYd}~Sd}~wwxYw)	a-
        Assert that the expected exception is raised when calling a
        function, and that the right error message is included with
        that exception.

        Arguments:
          func -- the function to call
          args -- positional arguments to `func`
          kwargs -- keyword arguments to `func`
          expected_exception -- exception that should be raised
          expected_message -- expected exception message (or pattern
            if a compiled regex object)

        Returns the exception raised for further testing.
        Nr$znexpected exception %(expected_exception)s not raised
called %(func)r
with args %(args)r
and kwargs %(kwargs)r
z%expected exception message pattern:
/z/
actual exception message:
'''z'''
zexpected exception message:
'''z!'''
actual exception message:
''')
failr6str
isinstancerePattern
assertTruesearchpatternr5)rfuncr7kwargsexpected_exceptionexpected_messageerractual_messages        rassertRaiseszBaseTest.assertRaisesOs*<D>F	$!&!.
II
i	
-"	 XN*BJJ7 0 7 7 G12  !1")*J)	s/B2A3B-'B2-B2c	|jj||jdy#t$r&}|j	|j
|Yd}~yd}~wwxYw)z
        Assert the parser fails with the expected message.  Caller
        must ensure that self.parser is an InterceptingOptionParser.
        zexpected parse failureN)r2r3assertFalserr5r)rcmdline_argsexpected_outputrKs    rassertParseFailzBaseTest.assertParseFailsW
	7KK""<0
56 	AS..@@	As/	AAANctj}		tt_|jj	|tjj}|t_	|j
dy#tjj}|t_wxYw#t$r}|jttdt|z||k7r|jd|zdz|zdz|j|j||j|j|Yd}~yd}~wwxYw)z7Assert the parser prints the expected output on stdout.zexpected parser.exit()z0expected output to be an ordinary string, not %rzexpected: 
'''
z'''
but got 
'''
z'''N)sysstdoutrr2r3getvaluerOrrDrAr@typer?r5rr)rrPrQexpected_statusexpected_errorsave_stdoutoutputrKs        rassertOutputzBaseTest.assertOutputsjj	7
)%Z
&&|4,,.(

56,,.(

	?OO63'Bv,
 
(		-?0139:<ABCS__o>S--~>>
	?s*.A=)B+=+B((B++	E4BD??Ec6|j||dt|y)z4Assert that TypeError is raised when executing func.N)rM	TypeError)rrGrJr7s    rassertTypeErrorzBaseTest.assertTypeErrors$dI7GHrch|j}||k7r|jd|zdz|zdzy)Nzhelp text failure; expected:
"z	"; got:
"z"
)format_helpfailureException)rr2
expected_helpactual_helps    r
assertHelpzBaseTest.assertHelpsS((*-'''1 ,-#$%
%(rr.)	r!r"r#r=rMrRr\r_rer$rrr0r00s**<6v
7&'$(	7:I%rr0ceZdZdZgifdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZy)TestOptionChecksc.tt|_yNusager	rr2rs rsetUpzTestOptionChecks.setUp"8rc>|jt||t|yr)rMrr)rrJr7rHs    rassertOptionErrorz"TestOptionChecks.assertOptionErrors+tV%'7	9rc0|jtdy)Nz+at least one option string must be supplied)r_rrs rtest_opt_string_emptyz&TestOptionChecks.test_opt_string_emptys[J	Lrc*|jddgy)Nz?invalid option string 'b': must be at least two characters longbrprs rtest_opt_string_too_shortz*TestOptionChecks.test_opt_string_too_shortsM
E	rc*|jddgy)NzOinvalid short option string '--': must be of the form -x, (x any non-dash char)--rurs rtest_opt_string_short_invalidz.TestOptionChecks.test_opt_string_short_invalids
4
F	rc*|jddgy)NzJinvalid long option string '---': must start with --, followed by non-dashz---rurs rtest_opt_string_long_invalidz-TestOptionChecks.test_opt_string_long_invalids
7
G	rc2|jddgdddy)Nz.option -b: invalid keyword arguments: bar, foo-bfoobarrurs rtest_attr_invalidz"TestOptionChecks.test_attr_invalids<
FD.	0rc0|jddgddiy)Nz option -b: invalid action: 'foo'r}actionrrurs rtest_action_invalidz$TestOptionChecks.test_action_invalids.
FXu%	'rcd|jddgddi|jddgdtiy)Nz%option -b: invalid option type: 'foo'r}rWrz'option -b: invalid option type: 'tuple')rptuplers rtest_type_invalidz"TestOptionChecks.test_type_invalids<3
FVUO	%	
5
FVUO	%rc2|jddgdddy)Nz4option -b: must not supply a type for action 'count'r}countint)rrWrurs rtest_no_type_for_actionz(TestOptionChecks.test_no_type_for_actionsB
Fw6	8rc2|jdddgddiy)Nz@option -b/--bad: must supply a list of choices for type 'choice'r}--badrWchoicerurs rtest_no_choices_listz%TestOptionChecks.test_no_choices_lists#
(
7Ofh/	1rcdtdj}|jd|zddgdddy)NzBoption -b/--bad: choices must be a list of strings ('%s' supplied)r}rrzbad choicesrWchoices)rWr!rp)rtypenames  rtest_bad_choices_listz&TestOptionChecks.test_bad_choices_lists;8$$
&(0
1
7O7		9rc2|jddgdddy)Nz1option -b: must not supply choices for type 'int'r}rbadrrurs rtest_no_choices_for_typez)TestOptionChecks.test_no_choices_for_types?
FUe4	6rc2|jddgdddy)Nz:option -b: 'const' must not be supplied for action 'store'r}store)rconstrurs rtest_no_const_for_actionz)TestOptionChecks.test_no_const_for_actionH
Fw3	5rc2|jddgdddy)Nz:option -b: 'nargs' must not be supplied for action 'count'r}r)rnargsrurs rtest_no_nargs_for_actionz)TestOptionChecks.test_no_nargs_for_actionrrc2|jddgdddy)Nz'option -b: callback not callable: 'foo'r}callbackrrrrurs rtest_callback_not_callablez+TestOptionChecks.test_callback_not_callables"5
Fz!&(	)rcyrr$rs rdummyzTestOptionChecks.dummyrcH|jddgd|jddy)NzAoption -b: callback_args, if supplied, must be a tuple: not 'foo'r}rr)rr
callback_argsrprrs rtest_callback_args_no_tuplez,TestOptionChecks.test_callback_args_no_tuples+
)
Fz!%&+-	.rcH|jddgd|jddy)NzBoption -b: callback_kwargs, if supplied, must be a dict: not 'foo'r}rr)rrcallback_kwargsrrs rtest_callback_kwargs_no_dictz-TestOptionChecks.test_callback_kwargs_no_dict's+
(
Fz!%(-/	0rc2|jddgdddy)Nz<option -b: callback supplied ('foo') for non-callback optionr}rrrrurs rtest_no_callback_for_actionz,TestOptionChecks.test_no_callback_for_action/s"J
Fw!&(	)rc2|jddgdddy)Nz9option -b: callback_args supplied for non-callback optionr}rr)rrrurs r test_no_callback_args_for_actionz1TestOptionChecks.test_no_callback_args_for_action5s"G
Fw&+-	.rc2|jddgdddy)Nz;option -b: callback_kwargs supplied for non-callback optionr}rr)rrrurs r"test_no_callback_kwargs_for_actionz3TestOptionChecks.test_no_callback_kwargs_for_action;s"I
Fw(-/	0rcz|jddg|jdddg|jdddgy)NzMinvalid long option string '-debug': must start with --, followed by non-dashz-debugzXoption -d: invalid long option string '-debug': must start with --, followed by non-dash-dz--debugrurs rtest_no_single_dashz$TestOptionChecks.test_no_single_dashAsT
7
J	
	

(
8	
	

7
y!	#rN)r!r"r#rmrprrrvryr{rrrrrrrrrrrrrrrrrr$rrrgrgs}98:"9L
0
'
%8
196
5
5
)
.0).0#rrgc|eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
Ze
jdd
dZy)TestOptionParserct|_|jjdddddd|jjdd	d
ddy)N-v	--verbose-n--noisy
store_trueverboserdest-q--quiet--silentstore_false)r	r2
add_optionrs rrmzTestOptionParser.setUpRsR"nt[$	!-I		?tY
!.Y		@rcR|j|jjddy)Nznot an Option instance: Noner_r2rrs rtest_add_option_no_Optionz*TestOptionParser.test_add_option_no_OptionYs"T[[33;T	CrcT|j|jjdddyNzinvalid argumentsrrs r!test_add_option_invalid_argumentsz2TestOptionParser.test_add_option_invalid_arguments]s#T[[330$	>rcN|jjd}|j|t|j	|j
ddg|j	|jddg|j	|jd|j	|jdy)Nrrrrrr)	r2
get_optionassertIsInstancerr5_short_opts
_long_optsrr)ropt1s  rtest_get_optionz TestOptionParser.test_get_optionas{{%%d+dF+))D$<8;	*BCl3I.rc.|jjd}|jjd}|jjd}|jjd}|j||cxuxr|cxuxr	|uycy)Nrrrr)r2rrD)rropt2opt3opt4s     rtest_get_option_equalsz'TestOptionParser.test_get_option_equalsiss{{%%d+{{%%k2{{%%d+{{%%i0444545rc|j|jjd|j|jjdy)Nrr)rDr2
has_optionrs rtest_has_optionz TestOptionParser.test_has_optionps8..t45..{;<rc\|j|jjddu|j|jjddu|j|jjddu|j|jjddu|j|jj	d|j|jj	d|j|jj	d|j|jj	d|j|jj	d|j|jj	dy)Nrrrrrr)rDr2rrOrrs rassertTrueremovedz"TestOptionParser.assertTrueremovedts,..t4<=..{;tCD..t4<=..y9TAB//56//<=//56//	:;..t45..z:;rcZ|jjd|jy)Nrr2
remove_optionrrs rtest_remove_short_optz&TestOptionParser.test_remove_short_opts !!$' rcZ|jjd|jy)Nrrrs rtest_remove_long_optz%TestOptionParser.test_remove_long_opts !!+. rc^|j|jjddtdy)Nrzno such option 'foo')rMr2r
ValueErrorrs rtest_remove_nonexistentz(TestOptionParser.test_remove_nonexistents&$++33Xt$&<	>rzRelies on sys.getrefcountT)cpythoncdg}tj|}t}|jdd||_|j~|j
|tj|y)N*-az	--aaarggh)rTgetrefcountr	r	big_thingdestroyr5)rrrefcountr2s    rtest_refleakzTestOptionParser.test_refleaks^D	??9-$,$3??9#=>rN)r!r"r#rmrrrrrrrrrrimpl_detailrr$rrrrQs[@C>/6=<!!>W4dC?D?rrceZdZdZdZy)TestOptionValuescyrr$rs rrmzTestOptionValues.setUprrct}|jt|i|j|i|j|ddi|j|dddd}t|}|jt|||j|||j|ddi|j|i|j|d|j|gy)Nrrrr)rbaz)defaults)rr5r4assertNotEqual)rvaluesdicts   rtest_basicszTestOptionValues.test_basicssfr*$FUEN3FB'R(&ft,&FUEN3FB'FB'FB'rN)r!r"r#rmrr$rrrrs
(rrceZdZdZdZdZy)TestTypeAliasesc"t|_yr)r	r2rs rrmzTestTypeAliases.setUps"nrc|jjdd|j|jjdjdy)N-sr@rWstring)r2rr5rrWrs rtest_str_aliases_stringz'TestTypeAliases.test_str_aliases_strings>t%0//5::HErc\|jjdt|j|jj	dj
d|jjdt|j|jj	dj
dy)Nrrr-xr)r2rr@r5rrWrrs rtest_type_objectz TestTypeAliases.test_type_objectszt#.//5::HEt#.//5::EBrN)r!r"r#rmrr	r$rrrrs%FCrrr<iiQ)smhdc	|djrt|St|ddt|dzS#ttf$rtd|d|wxYw)Nzoption z: invalid duration: )isdigitr_time_unitsr
IndexErrorroptionoptvalues   r_check_durationrsh>9u:uSbz?[r%;;;
#>14e<>	>>s
;;!AcleZdZejdzZej
ejZeed<y)DurationOption)durationrN)r!r"r#rTYPEScopyTYPE_CHECKERrr$rrrrs0LL=(E499V001L.Lrrc*eZdZdZdZdZdZdZy)TestDefaultValuesct|_|jjddd|jjddd|jjd	d
d|jjd
d
|jjdd|jjd|jjddddddddd|_y)NrrTdefaultrrr)rrr%rWr#z-mrrr-tz-u)rnrrtu)r	r2rexpectedrs rrmzTestDefaultValues.setUps"nt[$?tYY?t%<t%0tU3t$tT2%)!#$##&
rcl|j|jj|jyr)r5r2get_default_valuesr*rs rtest_basic_defaultsz%TestDefaultValues.test_basic_defaultss#7794==Irc|jjdd|jjddd|j	|jj|jy)Nri)r'r)r2set_defaultsr*updater5r,rs rtest_mixed_defaults_postz*TestDefaultValues.test_mixed_defaults_postsQ  2 .

2D127794==Ircd|jjdd|jjdd|jjd|jj	ddd|j|jj
|j|jjd|jjdd|jj	ddi|j|jj
|jy)	Nbarfblah)xyrfrobr"z-yr6)r2r/rr*r0r5r,rrs rtest_mixed_defaults_prez)TestDefaultValues.test_mixed_defaults_pres  6V 4tV4t$

6787794==I!!$'tT2

c4[)7794==Irc`t|j_|jjddd|jjddd|jj	d|j
j
dd	d
d|j|jj|j
|jjd|j
j
dddd|j|jj|j
y)
Nrri,r%z-e6m42)r'ihr)rer'F)
rr2option_classrr/r*r0r5r,set_process_default_valuesrs rtest_process_defaultz&TestDefaultValues.test_process_defaults#1 t*cBt*dC  4 (

3Sr:;7794==I..u5

3T=>7794==IrN)r!r"r#rmr-r1r8r?r$rrr r s& JJ
J
Jrr c(eZdZdZdZdZdZdZy)TestProgNamez]
    Test that %prog expands to the right thing in usage, version,
    and help strings.
    cD|j|j|yr)r5	get_usagerr2expected_usages   rassertUsagezTestProgName.assertUsages))+^<rcD|j|j|yr)r5get_version)rr2expected_versions   r
assertVersionzTestProgName.assertVersions++-/?@rc|tjdd}	tjj	dddtjd<tdd}d}|j
|||j|d	|j||d
zdz|tjddy#|tjddwxYw)Nrrzbaz.pyrz	%prog ...z	%prog 1.2)versionzUsage: baz.py ...
z
baz.py 1.2
zlOptions:
  --version   show program's version number and exit
  -h, --help  show this help message and exit
)	rTargvospathjoinr	rFrJre)r	save_argvr2rEs    rtest_default_prognamez"TestProgName.test_default_prognamesHHQK		$'',,ueX>CHHQK!+{CF2NV^4v|4OOF*T1NN
O$CHHQK)CHHQKsA=B&&B;ctddd}|jd|jdd}|j|||j|d|j	||d	zy)
Nthingy	%prog 0.1z
%prog arg arg)progrLrk-h	--versionzUsage: thingy arg arg
z
thingy 0.1rM)r	rrFrJrerDs   rtest_custom_prognamez!TestProgName.test_custom_progname'sj8&1$35	T"[)206<0 56rN)r!r"r#__doc__rFrJrSrZr$rrrArA	s
=A$"	7rrAcHeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
Zy)TestExpandDefaultsctd|_d|_d|_|jdz|_|jdz|_y)Ntest)rWzXUsage: test [options]

Options:
  -h, --help            show this help message and exit
z"read from FILE [default: %default]z:  -f FILE, --file=FILE  read from FILE [default: foo.txt]
z7  -f FILE, --file=FILE  read from FILE [default: none]
)r	r2help_prefix	file_helpexpected_help_fileexpected_help_noners rrmzTestExpandDefaults.setUp4sO"/>"&"2"2I#J"&"2"2F#Grc|jjddd|j|j|j|jy)N-f--filefoo.txtr#help)r2rrarerbrs rtest_option_defaultz&TestExpandDefaults.test_option_defaultBsAtX'0$(NN		4	
T%<%<=rc|jjdd|j|jjdd|j	|j|j
y)Nrerfrifilerg)r2rraset_defaultrerbrs rtest_parser_default_1z(TestExpandDefaults.test_parser_default_1HsPtX$(NN		4	2T%<%<=rc|jjdd|j|jjd|j	|j|j
y)Nrerfrlrgrm)r2rrar/rerbrs rtest_parser_default_2z(TestExpandDefaults.test_parser_default_2NsQtX$(NN		4  i 0T%<%<=rc|jjdd|j|j|j|jy)Nrerfrlr2rrarercrs rtest_no_defaultz"TestExpandDefaults.test_no_defaultTs<tX$(NN		4T%<%<=rc|jjddd|j|j|j|jy)Nrerfrhrtrs rtest_default_none_1z&TestExpandDefaults.test_default_none_1YsAtX'+$(NN		4	
T%<%<=rc|jjdd|j|jjd|j	|j|j
y)Nrerfrlrq)r2rrar/rercrs rtest_default_none_2z&TestExpandDefaults.test_default_none_2_sQtX$(NN		4  d +T%<%<=rc|jjddd|jjd|jdz}|j	|j|y)N-pz--probz1blow up with probability PROB [default: %default]rlgQ?)probzF  -p PROB, --prob=PROB  blow up with probability PROB [default: 0.43]
)r2rr/r`rerrcs  rtest_float_defaultz%TestExpandDefaults.test_float_defaultes_(D		F	
  d +((UV
]3rc|jjddddd|jj_|j	|j|j
y)Nrerfrgz#read from FILE [default: *DEFAULT*]rhz	*DEFAULT*)r2r	formatterdefault_tagrerbrs rtest_alt_expandz"TestExpandDefaults.test_alt_expandnsPtX'0$I		K-8)T%<%<=rc|jjddddd|jj_|jdz}|j|j|y)Nrerfrgzread from %default filerhz0  -f FILE, --file=FILE  read from %default file
)r2rrrr`rer}s  rtest_no_expandz!TestExpandDefaults.test_no_expandus]tX'0$=		?-1)((?@
]3rN)
r!r"r#rmrjrorrrurwryr~rrr$rrr]r]3s5G>>>>
>>4>4rr]ceZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy)TestStandardctddtddddtd	d
g}tt||_y)
Nrrrr}--boorboorWr--fooappendrrkoption_listrr&rr2rr:s  rrmzTestStandard.setUps?t(3tW5uEwx8:/^;BDrc*|jdgdy)Nrz-a option requires 1 argumentrRrs rtest_required_valuez TestStandard.test_required_valuesdV%DErc,|jddgdy)Nr}5xz&option -b: invalid integer value: '5x'rrs rtest_invalid_integerz!TestStandard.test_invalid_integersdD\E	Grc*|jdgdy)Nz--boo13zno such option: --boo13rrs rtest_no_such_optionz TestStandard.test_no_such_optionsi[*CDrc*|jdgdy)Nz--boo=x5z)option --boo: invalid integer value: 'x5'rrs rtest_long_invalid_integerz&TestStandard.test_long_invalid_integersj\H	Jrc2|jgddddgy)Narrr=rs r
test_emptyzTestStandard.test_emptys2T$tDbIrc:|jgdddddgdgy)N)rrz
--foo=blahz--foo=rr4rrrs r"test_shortopt_empty_longopt_appendz/TestStandard.test_shortopt_empty_longopt_appends$=!#D&"F	rc:|jgdddgddgy)N)rrrrz--foo=x)rrr5rrrs rtest_long_option_appendz$TestStandard.test_long_option_appends&C!%#'#35		rc4|jdgddddgy)Nz-abcbcrrrs rtest_option_argument_joinedz(TestStandard.test_option_argument_joineds!F8!%d4@	rc6|jddgddddgy)Nr34rrrs rtest_option_argument_splitz'TestStandard.test_option_argument_splits#D$<!%d4@	rc4|jdgddddgy)Nz-b34"rrrs r#test_option_argument_joined_integerz0TestStandard.test_option_argument_joined_integers!F8!%b>	rc6|jddgddddgy)Nr}-5rrrs r+test_option_argument_split_negative_integerz8TestStandard.test_option_argument_split_negative_integers#D$<!%b>	rc4|jdgddddgy)Nz--boo=13
rrrs r test_long_option_argument_joinedz-TestStandard.test_long_option_argument_joineds!J<!%b>	rc6|jddgddddgy)Nr111orrrs rtest_long_option_argument_splitz,TestStandard.test_long_option_argument_splits$GU+!%c$?	rc8|jddgdddgdgy)N	--foo=bar-axyzxyzrrrrs rtest_long_option_short_optionz*TestStandard.test_long_option_short_options&K1!&tUGD	rc8|jddgdddgdgy)N--f=barrrrrrrs rtest_abbrev_long_optionz$TestStandard.test_abbrev_long_options&Iw/!&tUGD	rc|jjg\}}|jj}|jt	|t	|yr)r2r3r,r5r4)rr:r7rs    r
test_defaultszTestStandard.test_defaultssD++004$;;113hg7rch|jjdddd|jdgdy)N--fozrrrrrWrrz%ambiguous option: --f (--foo, --foz?)r2rrRrs rtest_ambiguous_optionz"TestStandard.test_ambiguous_options8ww$,5		:i[D	Frc8|jgddddgdgy)N)rrrrrrrrrs r test_short_and_long_option_splitz-TestStandard.test_short_and_long_option_splits"8!&tUGD	rc:|jgdddddgdgy)N)rr}123rr{rrrrrs r*test_short_option_split_long_option_appendz7TestStandard.test_short_option_split_long_option_appends$E!%c5%.I	rc8|jgddddddgy)N)rrrrrrrrs r*test_short_option_split_one_positional_argz7TestStandard.test_short_option_split_one_positional_args"/!&tDA!7	$rcn|jgdddddddg|jgddddgdgy)N)rrxrrrxrrr)rrxrrrrs r$test_short_option_consumes_separatorz1TestStandard.test_short_option_consumes_separatorsF5!%d4@!5>	+	
7!%dE7C	rc<|jgdddddddgfy)N)-abrxrrrtrrrrrs r&test_short_option_joined_and_separatorz3TestStandard.test_short_option_joined_and_separators*8!$T$?#U+	-	.rc:|jgddddgddgy)N)r-rrrtrrrrrs r"test_hyphen_becomes_positional_argz/TestStandard.test_hyphen_becomes_positional_args$7!$T5'B5	"rc:|jgdddddgdgy)N)-b3r}5rrrrrrrrs rtest_no_append_versus_appendz)TestStandard.test_no_append_versus_appends$J!%aG	rc6|jddgddddgy)Nrrrrrs r&test_option_consumes_optionlike_stringz3TestStandard.test_option_consumes_optionlike_strings#D%=!&tDA	rcd|jjdd|jdgdy)Nr&rrz-testzno such option: -errs r#test_combined_single_invalid_optionz0TestStandard.test_combined_single_invalid_options.tL9gY1	3rN)r!r"r#rmrrrrrrrrrrrrrrrrrrrrrrrrrrr$rrrrsDFGEJJ








8
F

$
.
"


3rrc*eZdZdZdZdZdZdZy)TestBoolcdtdddddtddd	d
g}t||_y)Nrrrrrrrr#rrrrr)rr	r2rs  rrmzTestBool.setUpsBt*&2$-')	+
t(&3$-/0#9rc.|jgddigy)Nrrrrs rtest_bool_defaultzTestBool.test_bool_defaults2%r?	rcp|jdgddig\}}|j|jduy)NrrrFr=rDrrr:r7s   rtest_bool_falsezTestBool.test_bool_falses;,,dV.7^-/1$	
501rcp|jdgddig\}}|j|jduy)NrrrTrrs   rtest_bool_truezTestBool.test_bool_true#s;,,dV.7^-/1$	
4/0rc2|jgdddigy)N)z-qvqrrrrrrs rtest_bool_flicker_on_and_offz%TestBool.test_bool_flicker_on_and_off)s/%q>	rN)r!r"r#rmrrrrr$rrrrs
:
21rrc$eZdZdZdZdZdZy)
TestChoicecrtt|_|jjddddgdy)Nrj-crr)onetwothree)rrWrrr&rr2rrs rrmzTestChoice.setUp/s2.^DtG($,6M		Orc4|jgdddidgy)N)rrrrrrrrs rtest_valid_choicezTestChoice.test_valid_choice4s /$e,!7	$rc,|jgddy)N)rfourabczEoption -c: invalid choice: 'four' (choose from 'one', 'two', 'three')rrs rtest_invalid_choicezTestChoice.test_invalid_choice9s2C	Drc|jjddgd|jjd}|j|jd|j|j
dy)Nrz	--default)rfivesix)rrr)r2rrr5rWrrrs  rtest_add_choice_optionz!TestChoice.test_add_choice_option>s]t['>		@kk$$T*8,W-rN)r!r"r#rmrrrr$rrrr.sO
$
D
.rrc`eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZy)	TestCountctt|_tddd|_|jj|j|jjddd|jjd	d
ddd
y)Nrjrrrrrrrrrstore_constrrrr)r&rr2rv_optrrs rrmzTestCount.setUpFsp.^D gIF
tzz*{YGtY&3)1		Nrc.|jgddigy)Nrrrs rrzTestCount.test_emptyNs2	40"5rc0|jdgddigy)Nrrrrrs rtest_count_onezTestCount.test_count_oneQsD6Iq>26rc0|jdgddigy)N-vvvrrrs rtest_count_threezTestCount.test_count_threeTsF8i^R8rc2|jgdddigy)N)rrrrrrrs rtest_count_three_apartz TestCount.test_count_three_apartWs-	1~rBrc2|jddgddigy)Nr
--verbose=2rrrrs rtest_count_override_amountz$TestCount.test_count_override_amountZsFM2YNBGrc2|jgdddigy)N)r
rrrrrrs rtest_count_override_quietz#TestCount.test_count_override_quiet]s89a."Mrc2|jgdddigy)Nr
rrrrrrrs rtest_count_overridingzTestCount.test_count_overriding`s>%q>2	/rc4|jgdddidgy)Nr3rrrrrrs rtest_count_interspersed_argsz&TestCount.test_count_interspersed_argsds1%q>5	"rcj|jj|jgdddiddgy)Nrrrrr)r2disable_interspersed_argsr=rs rtest_count_no_interspersed_argsz)TestCount.test_count_no_interspersed_argsis1--/1%q>;	(rc,|jddgdy)Nz-q3rzno such option: -3rrs rtest_count_no_such_optionz#TestCount.test_count_no_such_optionoseT],@Arc,|jddgdy)Nz	--quiet=3rz$--quiet option does not take a valuerrs rtest_count_option_no_valuez$TestCount.test_count_option_no_valuersk40C	Ercf|jjdd|jgddigy)Nrrr2rnr=rs rtest_count_with_defaultz!TestCount.test_count_with_defaultvs,	1-2	!}b1rcj|jjdd|jgdddigy)Nrrrrr&rs rtest_count_overriding_defaultz'TestCount.test_count_overriding_defaultzs0	1->%q>2	/rN)r!r"r#rmrrrrrrrrr r"r$r'r)r$rrrrEsNN679CHN/"
(BE2/rrc*eZdZdZdZdZdZdZy)TestMultipleArgscptt|_|jjddddddy)	Nrjr{--pointrrfloatpointrrrWrrrs rrmzTestMultipleArgs.setUps3.^DtY&-QW7		Trc6|jgdddiddgy)N)rr{12.5z-4.3rr/)g?@g333333rrrrs rtest_nargs_with_positional_argsz0TestMultipleArgs.test_nargs_with_positional_argss#C#%56!5>	+rc4|jgdddidgy)N)r--1r3z-0rr/)gr4grrrs rtest_nargs_long_optz$TestMultipleArgs.test_nargs_long_opts!@#%67!7	$rc,|jgddy)N)r{1.02x3.5z-option -p: invalid floating-point value: '2x'rrs rtest_nargs_invalid_float_valuez/TestMultipleArgs.test_nargs_invalid_float_values7B	Crc,|jgddy)N)r-r:r<z#--point option requires 3 argumentsrrs rtest_nargs_required_valuesz+TestMultipleArgs.test_nargs_required_valuess6B	DrN)r!r"r#rmr5r8r=r?r$rrr+r+sT
+
$
C
Drr+c*eZdZdZdZdZdZdZy)TestMultipleArgsAppendctt|_|jjdddddd|jjd	d
ddd
d|jjdddddy)Nrjr{r-rrr.r/r0rerrrrr-z--zeroappend_constrrrrrs rrmzTestMultipleArgsAppend.setUpsx.^DtYwa$+'		;tWXQ$)		7tXn$)		9rc:|jgddddgddgy)N)re4-3r4rr2666))rir/rr4rrs rtest_nargs_appendz(TestMultipleArgsAppend.test_nargs_appends%I%)7H2EF"8	%rc*|jdgdy)Nz-f4,3z-f option requires 2 argumentsrrs r!test_nargs_append_required_valuesz8TestMultipleArgsAppend.test_nargs_append_required_valuessgY=	?rc6|jddgddgdgy)Nz--foo=3rHrrKrMrrs rtest_nargs_append_simplez/TestMultipleArgsAppend.test_nargs_append_simples$Is+%)&:	rc8|jgddgddgy)N)rDrrrHrC)rFrRrFrMrrs rtest_nargs_append_constz.TestMultipleArgsAppend.test_nargs_append_consts>%)1IJ	rN)r!r"r#rmrNrPrSrUr$rrrArAs9%
?
rrAceZdZdZdZy)TestVersioncTttd|_tjdd}	t
jjt
jddtjd<|jdgd|tjddy#|tjddwxYw)NrV)rkrLrrrrYzbar 0.1
)
r&rr2rTrNrOrPrQcurdirr\)rrRs  rtest_versionzTestVersion.test_versionsu.^7BDHHQK		$'',,ryy%?CHHQK{m[9#CHHQK)CHHQKsABB'cTtt|_|jdgdy)NrjrYzno such option: --version)r&rr2rRrs rtest_no_versionzTestVersion.test_no_versions#.^Dk]8	:rN)r!r"r#rZr\r$rrrWrWs$:rrWc"eZdZdZdZdZdZy)TestConflictingDefaultsz4Conflicting default values: the last one should win.cBttddddg|_y)Nrrrrrr)r	rr2rs rrmzTestConflictingDefaults.setUps#"\	1M0OPrcl|jjdddd|jgddigy)Nrrrrrr2rr=rs rtest_conflict_defaultz-TestConflictingDefaults.test_conflict_defaults8tM	'(		*2	1~r2rcl|jjdddd|jgddigy)Nrrrrrars rtest_conflict_default_nonez2TestConflictingDefaults.test_conflict_default_nones9tM	'+		-2	40"5rN)r!r"r#r[rmrbrdr$rrr^r^s>P3
6rr^c0eZdZdZdZdZdZdZdZy)TestOptionGroupc.tt|_yrirlrs rrmzTestOptionGroup.setUprnrct|jd}|jj||jddd|j	dgddigy)NSpamz--spamrzspam spam spam spamrrispamr)r
r2add_option_grouprr=rgroups  r!test_option_group_create_instancez1TestOptionGroup.test_option_group_create_instancesVDKK0$$U+
,3		5H:{B7rcR|j|jjddy)Nz!not an OptionGroup instance: Noner_r2rlrs rtest_add_group_no_groupz'TestOptionGroup.test_add_group_no_groups"T[[99@$	HrcT|j|jjdddyrrqrs r test_add_group_invalid_argumentsz0TestOptionGroup.test_add_group_invalid_argumentss#T[[990$	>rct|jd}t|_|j|jj|fdt
dy)Nriz"invalid OptionGroup (wrong parser))r
r2r	rMrlrrms  rtest_add_group_wrong_parserz+TestOptionGroup.test_add_group_wrong_parsersBDKK0#~$++66$$&J	Lrc|jjdd}|jd|jdd|j	|jjd|y)NzGroup 2zSome more options)descriptionBaconz--baconrr)r2rl	set_titlerrDget_option_grouprms  rtest_group_manipulatez%TestOptionGroup.test_group_manipulates],,Y9L-N
 
/44Y?GrN)	r!r"r#rmrorrrtrvr|r$rrrfrfs#98H>LHrrfc@eZdZdZdZGddeZdZdZdZ	y)	TestExtendAddTypesctt|j|_|jj	dddd|jj	ddddy)	N)rkr=rrrrrerfrm)r&rMyOptionr2rrs rrmzTestExtendAddTypes.setUpsN.^<@MMKtTsCtXFHrcHtjjtjr$tj
tjytjj
tjr$tjtjyyr)rOrPisdirrTESTFNrmdirisfileunlinkrs rtearDownzTestExtendAddTypes.tearDownsW
77==))*HHY%%&
WW^^I,,
-IIi&&'.rcreZdZdZej
dzZejejZeed<y)TestExtendAddTypes.MyOptionctjj|std|ztjj	|std|z|S)N%s: file does not exist%s: not a regular file)rOrPexistsrrrs   r
check_filez&TestExtendAddTypes.MyOption.check_filesI77>>%(&'@5'HIIWW^^E*&'?%'GHHLrrqrmN)r!r"r#rrrrrr$rrrrs7	y( tyy!4!45)Vrrctjtj|jdtjdgtjddgy)Nrf-afoor)rmr)rcreate_empty_filerr=rs rtest_filetype_okz#TestExtendAddTypes.test_filetype_oksD##I$4$45Hi&6&6@$-$4$45A	rcl|jdtjdgdtjzy)Nrfrr)rRrrrs rtest_filetype_noexistz(TestExtendAddTypes.test_filetype_noexists0h	(8(8'B6&--.	/rctjtj|j	dtjdgdtjzy)Nrfrr)rOmkdirrrrRrs rtest_filetype_notfilez(TestExtendAddTypes.test_filetype_notfilesB
!!"h	(8(8'B5&--.	/rN)
r!r"r#rmrrrrrrr$rrr~r~s(I(
*F
*/
/rr~c4eZdZdZGddeZdZdZy)TestExtendAddActionscT|jdddddg}t||_y)Nr--appleextendrapplerr)rr	r2rs  rrmzTestExtendAddActions.setUp%s1==y&.W!>?"w7rcleZdZejdzZej
dzZejdzZdZy)TestExtendAddActions.MyOption)rc	|dk(r3|jd}|j|gj|ytj|||||||y)Nr,)splitensure_valuerrtake_action)rrrrrrr2lvalues        rrz)TestExtendAddActions.MyOption.take_action/sP!S)##D"-44V<""4sFE#)+rN)r!r"r#rACTIONS
STORE_ACTIONS
TYPED_ACTIONSrr$rrrr*s5..;.,,{:
,,{:
	+rrc6|jddgdgdigy)Nz	-afoo,barz--apple=blahr)rrr4rrs rtest_extend_add_actionz+TestExtendAddActions.test_extend_add_action7s#K8#%;<	rc6|jgddgdigy)N)rrz-abarz--apple=x,yr)rrr5r6rrs rtest_extend_add_action_normalz2TestExtendAddActions.test_extend_add_action_normal<s@#%=>	rN)r!r"r#rmrrrrr$rrrr$s8
+F+
rrc$eZdZdZdZdZdZy)TestCallbackc	tddd|jtddd|jddg}t|	|_y)
Nrrrrerfrfilename)rrrWrr)rprocess_optr	r2rs  rrmzTestCallback.setUpDsQt#&0(,(8(8:t'&0(,(8(8$,$.0		1#w7rc|dk(r|j|jdg|j|jg|j||ju|j|du|jt|jddid|j_y|dk(r|j|jdg|j|jdg|j||ju|j|d|jt|jdddt|j|j|y|jd|zy)	Nrrrrfrerrr5z!Unknown option %r in process_opt.)r5rrrDr2r4rr5setattrrr?rrrrparser_s     rrzTestCallback.process_optQs&$;V//$8V..3OOGt{{23OOETM*T'..1J3EF!GNN
H_V//$8V..
;OOGt{{23UE*T'..123NOGNNFKK7II9C?@rc4|jddgdddgy)Nrz
--file=foorrrrrs r
test_callbackzTestCallback.test_callbackes"D,/(-B7	rctt}|jd|jdddddd	d
}|j	||y)NrjrXr&z--testrcyrr$r$rr<lambda>z1TestCallback.test_callback_help.<locals>.<lambda>qsrrr)rrrWriz%Options:
  -t TEST, --test=TEST  foo
)r	rrrre)rr2rcs   rtest_callback_helpzTestCallback.test_callback_helpjsRN3T"$#/h$		&9

.rN)r!r"r#rmrrrr$rrrrCs8A(
/rrceZdZdZdZdZy)TestCallbackExtraArgsc
ntddd|jdtfddgg}t||_y)	Nr{r-rrrpoints)rrrrWrr#r)r
process_tuplerr	r2rs  rrmzTestCallbackExtraArgs.setUpzs<tYz(,(:(:./XH$,b:;#w7rcZ|j|d|j|tu|dk(r|j|dn|dk(r|j|dtt	||jd}t
|j|jj|y)Nrr{z1,2,3r-4,5,6r)
r5rDrrmaprgetattrrrr)rrrrrlenrWs       rrz#TestCallbackExtraArgs.process_tuplesa $$;UG,
I
UG,c$C 012,33E:rc6|jgddddgigy)N)z-p1,2,3r-rrrrr)rKrrrs rtest_callback_extra_argsz.TestCallbackExtraArgs.test_callback_extra_argss#:$w&89	rN)r!r"r#rmrrr$rrrrys8
;rrc$eZdZdZdZdZdZy)TestCallbackMeddleArgsc	tdddDcgc]$}tt|d|jd&}}t	||_ycc}w)Nrirthingsrrrr)rangerr@	process_nr	r2)rr5r:s   rrmzTestCallbackMeddleArgs.setUpsT""b"-/s1vj(,XG//#w7/s)A
cFt|dd}|j}t||kr|jd||fz|jj|jg}|jt|d||jj||d|=y)Nrz$Expected %d arguments for %s option.r)
rrargsrr?rrrrrlargs)rrrrrrrrs        rrz TestCallbackMeddleArgs.process_nsCG

u:II<s|KL~~**6;;;E%%.)*

U#!E'Nrc:|jgddddgiddgy)N)r7rrIrrquxrr)rrrrrrrs rtest_callback_meddle_argsz0TestCallbackMeddleArgs.test_callback_meddle_argss(C$x1F&GHq6	#rc6|jgdddgidgy)N)z-2rrxr)rrxrrrs r#test_callback_meddle_args_separatorz:TestCallbackMeddleArgs.test_callback_meddle_args_separators".$}o63	 rN)r!r"r#rmrrrr$rrrrs8	#
 rrceZdZdZdZdZy)TestCallbackManyArgsc	tdddd|jdtdddd	|jd
g}t||_y)Nrrrrr)rrrrWr}--bobrrr)rprocess_manyr	r2rs  rrmzTestCallbackManyArgs.setUpsPtYz(,(9(9JtWZq(,(9(9GH#w7rc|dk(r|j|dy|dk(r|j|dy|dk(r|j|dy|dk(r|j|dyy)	Nrr~r)dingdongr}rr)ifrrr5rs     rrz!TestCallbackManyArgs.process_manyse$;UN3
I
U$45
D[UI.
G^UM2rc4|jgddddgy)N)rrrrrrr}r22rrz-666r;0)rbobrrs rtest_many_argsz#TestCallbackManyArgs.test_many_argss"!&*$7		rN)r!r"r#rmrrr$rrrrs83rrceZdZdZdZdZy)TestCallbackCheckAbbrevcrt|_|jjdd|jy)N	--foo-barrr)r	r2rcheck_abbrevrs rrmzTestCallbackCheckAbbrev.setUps/"n{:(,(9(9		;rc(|j|dy)Nrrrrrrr2s     rrz$TestCallbackCheckAbbrev.check_abbrevsk*rc,|jdgigy)Nrrrs rtest_abbrev_callback_expansionz6TestCallbackCheckAbbrev.test_abbrev_callback_expansionsG9b"-rN)r!r"r#rmrrr$rrrrs;
+.rrc6eZdZdZdZdZdZdZdZdZ	y)	TestCallbackVarArgsc	tddddtddd	td
dd|jd
g}tt||_y)Nrrrr)rWrrr}rrtrr
--callbackrcrr)r
variable_argsr&rr2rs  rrmzTestCallbackVarArgs.setUpsRt%qsCtLsCt\*(,(:(:FG/^;BDrc.|j|dug}|j}|rQ|d}|dddk(rt|dkDs|dddk(rt|dkDr	|ddk7rn|j||d=|rQt	|j
|j|y)Nrrrxrr)rDrrrrrr)rrrrr2rargs       rrz!TestCallbackVarArgs.variable_argss
&(CRaDSX\RaCCHqLSVs]S!!H	

v{{E2rc:|jgdddddgdgy)N)z-a3rrrr)rrrrrrtrrrs rtest_variable_argsz&TestCallbackVarArgs.test_variable_argss$D!(t5%.I	rc<|jgdddgdddgy)N)r37rxxxxr}helloT)rrxrrrrrs r%test_consume_separator_stop_at_optionz9TestCallbackVarArgs.test_consume_separator_stop_at_options(C!%!%!46$9		&rc<|jgdddgdddgy)N)rrrrr)rrrrrrrs r%test_positional_arg_and_variable_argsz9TestCallbackVarArgs.test_positional_arg_and_variable_argss(=!%!% 35$9		&rc8|jgddddgdgy)N)rrr}Trrrrs rtest_stop_at_optionz'TestCallbackVarArgs.test_stop_at_options".!%Dw?	rc,|jgddy)N)rrrrzno such option: -5rrs rtest_stop_at_invalid_optionz/TestCallbackVarArgs.test_stop_at_invalid_options46JKrN)
r!r"r#rmrrrrrrr$rrrrs'D3
&&
LrrceZdZdZdZy)ConflictBasecRtdddddg}tt||_y)Nrrrrzincrement verbosityrrrirrrs  rrmzConflictBase.setUp
s1t[$-4IKL.^;BDrc&d|j_y)Nr)rshow_versionrs     rrzConflictBase.show_versions%&

"rN)r!r"r#rmrr$rrrr	s
D'rrc(eZdZdZdZdZdZdZy)TestConflictz9Use the default conflict resolution for Optik 1.2: error.c|j|dd|jddtd}|j|jd|j|j
dy)N)rrYrshow versionrrriz5option -v/--version: conflicting option string(s): -vz conflicting option string(s): -vz-v/--version)rMrr
r5r*	option_id)rrGrKs   rassertTrueconflict_errorz%TestConflict.assertTrueconflict_errors`%:595F5F1?(A
 CE	
"DE7rcN|j|jjyr)rr2rrs rtest_conflict_errorz TestConflict.test_conflict_error s%%dkk&<&<=rcft|jd}|j|jy)NzGroup 1)r
r2rrrms  rtest_conflict_error_groupz&TestConflict.test_conflict_error_group#s&DKK3%%e&6&67rc^|j|jjddtdy)Nrz'invalid conflict_resolution value 'foo')rMr2set_conflict_handlerrrs rtest_no_such_conflict_handlerz*TestConflict.test_no_such_conflict_handler's(KK,,hA	CrN)r!r"r#r[rrrrr$rrrrsC	8>8Crrc0eZdZdZdZdZdZdZdZy)TestConflictResolvectj||jjd|jj	ddd|j
dy)NresolverrYrrr)rrmr2rrrrs rrmzTestConflictResolve.setUp.sK4 ((3t[(,(9(9		Prc|jjd}|jjd}|jjd}|j||u|j||u|j|jdg|j|j
dg|j|jdg|j|j
g|j|jdgy)NrrrY)r2rrDr5rr)rrverbose_optversion_opts    rtest_conflict_resolvez)TestConflictResolve.test_conflict_resolve4s&&t,kk,,[9kk,,[9,-[01))K=9004&9//+?00"5//+?rc*|jdgdy)NrXz}Options:
  --verbose      increment verbosity
  -h, --help     show this help message and exit
  -v, --version  show version
r\rs rtest_conflict_resolve_helpz.TestConflictResolve.test_conflict_resolve_helpAs4&#	rc2|jdgdddgy)Nrrrrrrs rtest_conflict_resolve_short_optz3TestConflictResolve.test_conflict_resolve_short_optIsD6'+Q?	rc0|jdgddigy)Nrrrrrs rtest_conflict_resolve_long_optz2TestConflictResolve.test_conflict_resolve_long_optNsK=%q>	rc4|jddgdddgy)NrrYrr'rrs rtest_conflict_resolve_long_optsz3TestConflictResolve.test_conflict_resolve_long_optsSs"K5'(!<	rN)	r!r"r#rmr"r%r(r*r,r$rrrr-s"P@

rrc$eZdZdZdZdZdZy)TestConflictOverridectt|_|jjd|jj	ddddd|jj	ddd	d
ddy)
Nrjrr	--dry-runrdry_runzdon't do anythingr
rrzdry run mode)rrrri)r&rr2rrrs rrmzTestConflictOverride.setUpYsj.^D((3t[&2$7		9	
{D&32I$2		4rc|jjd}|j|jdg|j|jdgy)Nr0r)r2rr5rrrs  rtest_conflict_override_optsz0TestConflictOverride.test_conflict_override_optscsBkk$$[14&1+7rc*|jdgdy)NrXzXOptions:
  -h, --help     show this help message and exit
  -n, --dry-run  dry run mode
r$rs rtest_conflict_override_helpz0TestConflictOverride.test_conflict_override_helphs4&#	rc0|jdgddigy)Nrr1rrrs rtest_conflict_override_argsz0TestConflictOverride.test_conflict_override_argsosD6%r?	rN)r!r"r#rmr3r5r7r$rrr.r.Xs48
rr.aSUsage: bar.py [options]

Options:
  -a APPLE           throw APPLEs at basket
  -b NUM, --boo=NUM  shout "boo!" NUM times (in order to frighten away all the
                     evil spirits that cause trouble and mayhem)
  --foo=FOO          store FOO in the foo list for later fooing
  -h, --help         show this help message and exit
aSUsage: bar.py [options]

Options:
  -a APPLE           throw APPLEs at basket
  --boo=NUM, -b NUM  shout "boo!" NUM times (in order to frighten away all the
                     evil spirits that cause trouble and mayhem)
  --foo=FOO          store FOO in the foo list for later fooing
  --help, -h         show this help message and exit
aWUsage
=====
  bar.py [options]

Options
=======
-a APPLE           throw APPLEs at basket
--boo=NUM, -b NUM  shout "boo!" NUM times (in order to frighten away all the
                   evil spirits that cause trouble and mayhem)
--foo=FOO          store FOO in the foo list for later fooing
--help, -h         show this help message and exit
a}Usage: bar.py [options]

Options:
  -a APPLE           throw APPLEs at basket
  -b NUM, --boo=NUM  shout "boo!" NUM times (in order to
                     frighten away all the evil spirits
                     that cause trouble and mayhem)
  --foo=FOO          store FOO in the foo list for later
                     fooing
  -h, --help         show this help message and exit
a~Usage: bar.py [options]

Options:
  -a APPLE
    throw
    APPLEs at
    basket
  -b NUM, --boo=NUM
    shout
    "boo!" NUM
    times (in
    order to
    frighten
    away all
    the evil
    spirits
    that cause
    trouble and
    mayhem)
  --foo=FOO
    store FOO
    in the foo
    list for
    later
    fooing
  -h, --help
    show this
    help
    message and
    exit
cNeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
y)
TestHelpc0|jd|_y)NP)make_parserr2rs rrmzTestHelp.setUps&&r*rc	tdddddtddd	d
ddtd
ddddg}tj5}t||d<t	|cdddS#1swYyxYw)NrrrAPPLEzthrow APPLEs at basket)rWrmetavarrir}rrrNUMzeshout "boo!" NUM times (in order to frighten away all the evil spirits that cause trouble and mayhem)rrrz*store FOO in the foo list for later fooing)rrWrriCOLUMNSr)rrEnvironmentVarGuardr@r&)rcolumnsr:envs    rr<zTestHelp.make_parsers8# '.F
HgE %N
O

xeI
K
 
*
*
,	A \C	N+@	A	A	AsA))A2c
tjdd}	tjj	ddtjd<|jdg||tjddy#|tjddwxYw)Nrzbar.pyrrX)rTrNrOrPrQr\)rrQrRs   rassertHelpEqualszTestHelp.assertHelpEqualss]HHQK		$'',,uh7CHHQKtfo6#CHHQK)CHHQKsAA--Bc.|jtyr)rF_expected_help_basicrs r	test_helpzTestHelp.test_helps23rcd|jjd|jty)NzUsage: %prog [options])r2	set_usagerFrHrs rtest_help_old_usagezTestHelp.test_help_old_usages$6723rcdd|jj_|jty)Nr)r2rshort_firstrF_expected_help_long_opts_firstrs rtest_help_long_opts_firstz"TestHelp.test_help_long_opts_firsts#,-)<=rctj5}d|d<t|j_|jtdddy#1swYyxYw)N80rA)rrBrr2rrF_expected_help_title_formatter)rrDs  rtest_help_title_formatterz"TestHelp.test_help_title_formattersP

*
*
,	B!C	N$7$9DKK!!!"@A	B	B	Bs4AAc|jd|_|jt|jd|_|jty)Nr
r)r<r2rF_expected_help_short_lines_expected_very_help_short_linesrs rtest_wrap_columnszTestHelp.test_wrap_columnssF&&r*89&&q)=>rctt|_|jjdddd}|j	|y)Nrjrrolé!rjuKOptions:
  -h, --help  show this help message and exit
  -a          olé!
)r&rr2rrFrexpects  rtest_help_unicodezTestHelp.test_help_unicodes>.^DtL{K
	
f%rcVttd|_d}|j|y)NrZ)rkrxu>olé!

Options:
  -h, --help  show this help message and exit
)r&rr2rFr[s  rtest_help_unicode_descriptionz&TestHelp.test_help_unicode_descriptions+.^;FH	
f%rc6|jjdt|jdd}|jddd|jj	|d}|j|d	|j_|j|d
zy)Nz`This is the program description for %prog.  %prog has an option group as well as single options.zDangerous OptionszZCaution: use of these options is at your own risk.  It is believed that some of them bite.z-grz
Group option.rjaTUsage: bar.py [options]

This is the program description for bar.py.  bar.py has an option group as
well as single options.

Options:
  -a APPLE           throw APPLEs at basket
  -b NUM, --boo=NUM  shout "boo!" NUM times (in order to frighten away all the
                     evil spirits that cause trouble and mayhem)
  --foo=FOO          store FOO in the foo list for later fooing
  -h, --help         show this help message and exit

  Dangerous Options:
    Caution: use of these options is at your own risk.  It is believed
    that some of them bite.

    -g               Group option.
z Please report bugs to /dev/null.z"
Please report bugs to /dev/null.
)r2set_descriptionr
rrlrFepilog)rrnr\s   rtest_help_description_groupsz%TestHelp.test_help_description_groupss##
9	:KK,
56	lI$$U+(	
f%?f'MMNrN)r!r"r#rmr<rFrIrLrPrTrXr]r_rcr$rrr9r9s<+A*$44>B?&	&#Orr9ceZdZdZdZy)TestMatchAbbrevc
F|jtdddddddy)N--f)rr--fierg)r5rrs rtest_match_abbrevz!TestMatchAbbrev.test_match_abbrev@s/u151515/3(56
	 rcRd}dddd}|jt||fdtdy)Nrg)rrrhz,ambiguous option: --f (--fie, --foo, --foz?))rMrr)rrwordmaps   rtest_match_abbrev_errorz'TestMatchAbbrev.test_match_abbrev_errorHs3 4$?Aw<J	LrN)r!r"r#rirlr$rrrere?s
 Lrrec$eZdZdZdZdZdZy)TestParseNumberct|_|jjdt|jjdty)Nrr-l)r&r2rrrs rrmzTestParseNumber.setUpQs:.0t#.t#.rc	|jtdtfitt	j
d|jtdtfitt	j
dy)Nrz!invalid literal for int().*: '?'?0xOoopsz*invalid literal for int().*: s?'?0xOoops'?)rMrrrrBcompilers rtest_parse_num_failz#TestParseNumber.test_parse_num_failVsXS	2JJ;<	>	
C("JJDE	Grc|jtdtd|jtdtd|jtdtd|jtdtd|jtd	td
|jtdtdy)Nrr0x100XA
0100b11r0b)r5rrrs rtest_parse_num_okz!TestParseNumber.test_parse_num_ok`sC-q1FC0"5E3/4E3/3FC0!4D#.2rc|jgddddg|jgddddg|jdgd	|jd
gd|jdd
gdy)N)rr;rp0x20r )r'l)r0b0101z-l010rr{z-n008z'option -n: invalid integer value: '008'z-l0b0123z*option -l: invalid integer value: '0b0123'rp0x12xz)option -l: invalid integer value: '0x12x')r=rRrs rtest_numeric_optionsz$TestParseNumber.test_numeric_optionshs|5"$412	74"#!-r	3gYF	Hj\I	KdG_H	JrN)r!r"r#rmrtr~rr$rrrnrnPs/
G3
JrrnceZdZdZy)MiscTestCasecDhd}tj|t|y)N>
NO_DEFAULT
check_builtinAmbiguousOptionError)not_exported)rcheck__all__optparse)rrs  rtest__all__zMiscTestCase.test__all__vsNT8,GrN)r!r"r#rr$rrrrusHrr__main__)HrTrOrBrunittestiorr_rtest.supportrrrrrr	r
rrr
rrrrr	Exceptionrr&TestCaser0rgrrrrrrr rAr]rrrrr+rArWr^rfr~rrrrrrrrrrr.rHrOrSrVrWr9rernrr!mainr$rr<module>rs		"....#
Ny
N2|2M%x  M%jJ#xJ#XL?xL?^(x(*ChC rh@>/V/
0J0Jf'78'7TI4I4\H38H3T!x!F...8/8/tDxD2X::(:$6h6 HhHD(/(/V8>3/83/lH2 X :82
.h
.0L(0Lj'8'C<C4),)V8<		""#BtOxtOnLhL""Jh"JJH8$$HzHMMOr