
    0hh                        S SK r S SKrS SKrS SKrS SKrS SKJr  S SKJr  S SK	J
r
  S SKJrJr  S SKrS SKJrJrJrJrJrJrJrJrJrJrJr  S SKJr  S SKJr   " S	 S
\5      r " S S\5      r " S S\R>                  5      r  " S S\ 5      r! " S S\ 5      r" " S S\ 5      r# " S S\ 5      r$SSSSS.r%S r& " S S\5      r' " S S \ 5      r( " S! S"\ 5      r) " S# S$\ 5      r* " S% S&\ 5      r+ " S' S(\ 5      r, " S) S*\ 5      r- " S+ S,\ 5      r. " S- S.\ 5      r/ " S/ S0\ 5      r0 " S1 S2\ 5      r1 " S3 S4\ 5      r2 " S5 S6\ 5      r3 " S7 S8\ 5      r4 " S9 S:\ 5      r5 " S; S<\ 5      r6 " S= S>\ 5      r7 " S? S@\ 5      r8 " SA SB\ 5      r9 " SC SD\ 5      r: " SE SF\ 5      r; " SG SH\ 5      r< " SI SJ\<5      r= " SK SL\<5      r> " SM SN\ 5      r?SOr@SPrASQrBSRrCSSrD " ST SU\ 5      rE " SV SW\ 5      rF " SX SY\ 5      rG " SZ S[\R>                  5      rH " S\ S]\5      rI\JS^:X  aU  \K" \ R                  5      S:  a-  \ R                  S   S_:X  a  \" \5        \ R                  " S 5        \R                  " 5         gg)`    N)StringIO)support)	os_helper)TestTranslationsBaseupdate_translation_snapshots)make_optionOptionTitledHelpFormatterOptionParserOptionGroupSUPPRESS_USAGEOptionErrorOptionConflictErrorBadOptionErrorOptionValueErrorValues)_match_abbrev)
_parse_numc                   *    \ rS rSr   SS jrS rSrg)InterceptedError   Nc                 (    Xl         X l        X0l        g N)error_messageexit_statusexit_message)selfr   r   r   s       ;/opt/python-3.13.8/usr/lib/python3.13/test/test_optparse.py__init__InterceptedError.__init__   s     +&(    c                 R    U R                   =(       d    U R                  =(       d    S$ )Nzintercepted error)r   r   r   s    r   __str__InterceptedError.__str__%   s    !!MT%6%6M:MMr!   )r   r   r   )NNN)__name__
__module____qualname____firstlineno__r   r$   __static_attributes__ r!   r   r   r      s    #!")Nr!   r   c                   $    \ rS rSrSS jrS rSrg)InterceptingOptionParser(   Nc                     [        XS9e)N)r   r   r   )r   statusmsgs      r   exitInterceptingOptionParser.exit)   s    6DDr!   c                     [        US9e)N)r   r0   )r   r2   s     r   errorInterceptingOptionParser.error,   s    S11r!   r+   r   N)r&   r'   r(   r)   r3   r6   r*   r+   r!   r   r-   r-   (   s    E2r!   r-   c                   @    \ rS rSrS rS rS r  S
S jrS rS r	S	r
g)BaseTest0   c                     U R                   R                  U5      u  pE[        U5      nU R                  XbS[	        5       -  5        U R                  XSS[	        5       -  5        XE4$ )ab  Assert 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_argsvarsassertEquallocals)r   argsexpected_optsexpected_positional_argsoptionspositional_argsoptdicts          r   assertParseOKBaseTest.assertParseOK1   ss     &*[[%;%;D%A"w-  "	# 	  #	$ ))r!   c           
         Uc  SnUc  0 n U" U0 UD6  U R                  S[        5       -  5        g! U a  n[        U5      n[        U[        R
                  5      (       a5  U R                  UR                  U5      SUR                  < SU< S35        OU R                  UUSU< SU< S35        Us SnA$ SnAff = f)	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'''
zexpected exception message:
'''z!'''
actual exception message:
''')
failrA   str
isinstancerePattern
assertTruesearchpatternr@   )r   funcrB   kwargsexpected_exceptionexpected_messageerractual_messages           r   assertRaisesBaseTest.assertRaisesO   s    * <D>F	$!&!. II  i	 - " 	 XN*BJJ77 0 7 7 G 12   !1 ")* J)	s   1 B>A<B93B>9B>c                      U R                   R                  U5        U R                  S5        g! [         a&  nU R	                  UR
                  U5         SnAgSnAff = f)zy
Assert the parser fails with the expected message.  Caller
must ensure that self.parser is an InterceptingOptionParser.
zexpected parse failureN)r=   r>   assertFalser   r@   r   )r   cmdline_argsexpected_outputrW   s       r   assertParseFailBaseTest.assertParseFail   sW    
	7KK""<0 56   	AS..@@	As   / 
AAANc                    [         R                  n  [        5       [         l        U R                  R	                  U5        [         R                  R                  5       nU[         l         U R                  S5        g! [         R                  R                  5       nU[         l        f = f! [         a  nU R                  [        W[        5      S[        U5      -  5        Xb:w  a  U R                  SU-   S-   U-   S-   5        U R                  UR                  U5        U R                  UR                  U5         SnAgSnAff = f)z7Assert the parser prints the expected output on stdout.zexpected parser.exit()z0expected output to be an ordinary string, not %rzexpected: 
'''
z'''
but got 
'''
z'''N)sysstdoutr   r=   r>   getvaluer\   r   rP   rM   rL   typerK   r@   r   r   )r   r]   r^   expected_statusexpected_errorsave_stdoutoutputrW   s           r   assertOutputBaseTest.assertOutput   s    jj	7)%Z
&&|4,,.(
 56 ,,.(
 
	?OO63'Bv, 
 (		-?0139:<AB CS__o>S--~>>
	?s*   .A= )B+ =+B((B+ +
E5BE  Ec                 4    U R                  XS[        U5        g)z4Assert that TypeError is raised when executing func.N)rY   	TypeError)r   rS   rV   rB   s       r   assertTypeErrorBaseTest.assertTypeError   s    $dI7GHr!   c                 h    UR                  5       nX2:w  a  U R                  SU-   S-   U-   S-   5      eg )Nzhelp text failure; expected:
"z	"; got:
"z"
)format_helpfailureException)r   r=   expected_helpactual_helps       r   
assertHelpBaseTest.assertHelp   sQ    ((*'''1 ,-#$% % (r!   r+   r8   )r&   r'   r(   r)   rH   rY   r_   rj   rn   ru   r*   r+   r!   r   r:   r:   0   s*    *<6v
7 &'$(	7:I%r!   r:   c                       \ rS rSrS r/ 0 4S jrS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rSrg)TestOptionChecks   c                 (    [        [        S9U l        g Nusager   r   r=   r#   s    r   setUpTestOptionChecks.setUp       "8r!   c                 <    U R                  [        X#[        U5        g r   )rY   r   r   )r   rV   rB   rT   s       r   assertOptionError"TestOptionChecks.assertOptionError   s    +t%'7	9r!   c                 0    U R                  [        S5        g )Nz+at least one option string must be supplied)rn   r   r#   s    r   test_opt_string_empty&TestOptionChecks.test_opt_string_empty   s    [J	Lr!   c                 *    U R                  SS/5        g )Nz?invalid option string 'b': must be at least two characters longbr   r#   s    r   test_opt_string_too_short*TestOptionChecks.test_opt_string_too_short   s    ME	r!   c                 *    U R                  SS/5        g )NzOinvalid short option string '--': must be of the form -x, (x any non-dash char)--r   r#   s    r   test_opt_string_short_invalid.TestOptionChecks.test_opt_string_short_invalid   s    4F	r!   c                 *    U R                  SS/5        g )NzJinvalid long option string '---': must start with --, followed by non-dashz---r   r#   s    r   test_opt_string_long_invalid-TestOptionChecks.test_opt_string_long_invalid   s    7G	r!   c                 2    U R                  SS/S S S.5        g )Nz.option -b: invalid keyword arguments: bar, foo-bfoobarr   r#   s    r   test_attr_invalid"TestOptionChecks.test_attr_invalid   s    <FD.	0r!   c                 0    U R                  SS/SS05        g )Nz option -b: invalid action: 'foo'r   actionr   r   r#   s    r   test_action_invalid$TestOptionChecks.test_action_invalid   s    .FXu%	'r!   c                 d    U R                  SS/SS05        U R                  SS/S[        05        g )Nz%option -b: invalid option type: 'foo'r   re   r   z'option -b: invalid option type: 'tuple')r   tupler#   s    r   test_type_invalid"TestOptionChecks.test_type_invalid   s<    3FVUO	% 	5FVUO	%r!   c                 2    U R                  SS/SSS.5        g )Nz4option -b: must not supply a type for action 'count'r   countint)r   re   r   r#   s    r   test_no_type_for_action(TestOptionChecks.test_no_type_for_action   s    BFw6	8r!   c                 2    U R                  SSS/SS05        g )Nz@option -b/--bad: must supply a list of choices for type 'choice'r   --badre   choicer   r#   s    r   test_no_choices_list%TestOptionChecks.test_no_choices_list   s#    (7Ofh/	1r!   c                 d    [        S5      R                  nU R                  SU-  SS/SSS.5        g )N zBoption -b/--bad: choices must be a list of strings ('%s' supplied)r   r   r   zbad choicesre   choices)re   r&   r   )r   typenames     r   test_bad_choices_list&TestOptionChecks.test_bad_choices_list   s;    8$$&(017O7		9r!   c                 2    U R                  SS/SSS.5        g )Nz1option -b: must not supply choices for type 'int'r   r   badr   r   r#   s    r   test_no_choices_for_type)TestOptionChecks.test_no_choices_for_type  s    ?FUe4	6r!   c                 2    U R                  SS/SSS.5        g )Nz:option -b: 'const' must not be supplied for action 'store'r   store   )r   constr   r#   s    r   test_no_const_for_action)TestOptionChecks.test_no_const_for_action      HFw3	5r!   c                 2    U R                  SS/SSS.5        g )Nz:option -b: 'nargs' must not be supplied for action 'count'r   r      )r   nargsr   r#   s    r   test_no_nargs_for_action)TestOptionChecks.test_no_nargs_for_action  r   r!   c                 2    U R                  SS/SSS.5        g )Nz'option -b: callback not callable: 'foo'r   callbackr   r   r   r   r#   s    r   test_callback_not_callable+TestOptionChecks.test_callback_not_callable  s"    5Fz!&(	)r!   c                     g r   r+   r#   s    r   dummyTestOptionChecks.dummy      r!   c                 H    U R                  SS/SU R                  SS.5        g )NzAoption -b: callback_args, if supplied, must be a tuple: not 'foo'r   r   r   )r   r   callback_argsr   r   r#   s    r   test_callback_args_no_tuple,TestOptionChecks.test_callback_args_no_tuple  s+    )Fz!%&+-	.r!   c                 H    U R                  SS/SU R                  SS.5        g )NzBoption -b: callback_kwargs, if supplied, must be a dict: not 'foo'r   r   r   )r   r   callback_kwargsr   r#   s    r   test_callback_kwargs_no_dict-TestOptionChecks.test_callback_kwargs_no_dict'  s+    (Fz!%(-/	0r!   c                 2    U R                  SS/SSS.5        g )Nz<option -b: callback supplied ('foo') for non-callback optionr   r   r   r   r   r#   s    r   test_no_callback_for_action,TestOptionChecks.test_no_callback_for_action/  s"    JFw!&(	)r!   c                 2    U R                  SS/SSS.5        g )Nz9option -b: callback_args supplied for non-callback optionr   r   r   )r   r   r   r#   s    r    test_no_callback_args_for_action1TestOptionChecks.test_no_callback_args_for_action5  s"    GFw&+-	.r!   c                 2    U R                  SS/SSS.5        g )Nz;option -b: callback_kwargs supplied for non-callback optionr   r   r   )r   r   r   r#   s    r   "test_no_callback_kwargs_for_action3TestOptionChecks.test_no_callback_kwargs_for_action;  s"    IFw(-/	0r!   c                 z    U R                  SS/5        U R                  SSS/5        U R                  SSS/5        g )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--debugr   r#   s    r   test_no_single_dash$TestOptionChecks.test_no_single_dashA  sT    7J	
 	(8	
 	7y!	#r!   r=   N)r&   r'   r(   r)   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r*   r+   r!   r   rx   rx      s}    9 8:" 9L
0
'
%8
196
5
5
).0).0#r!   rx   c                   ~    \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS r\R                  " SSS9S 5       rSrg)TestOptionParseriQ  c           	          [        5       U l        U R                  R                  SSSSSSS9  U R                  R                  SS	S
SSS9  g )N-v	--verbose-n--noisy
store_trueverboser   dest-q--quiet--silentstore_false)r   r=   
add_optionr#   s    r   r   TestOptionParser.setUpR  sR    "nt[$	!-I 	 	?tY
!.Y 	 	@r!   c                 R    U R                  U R                  R                  SS 5        g )Nznot an Option instance: Nonern   r=   r   r#   s    r   test_add_option_no_Option*TestOptionParser.test_add_option_no_OptionY  s"    T[[33;T	Cr!   c                 T    U R                  U R                  R                  SS S 5        g Nzinvalid argumentsr   r#   s    r   !test_add_option_invalid_arguments2TestOptionParser.test_add_option_invalid_arguments]  s#    T[[330$	>r!   c                 N   U R                   R                  S5      nU R                  U[        5        U R	                  UR
                  SS/5        U R	                  UR                  SS/5        U R	                  UR                  S5        U R	                  UR                  S5        g )Nr   r   r   r   r   r   )	r=   
get_optionassertIsInstancer	   r@   _short_opts
_long_optsr   r   )r   opt1s     r   test_get_option TestOptionParser.test_get_optiona  s    {{%%d+dF+))D$<8;	*BCl3I.r!   c                 @   U R                   R                  S5      nU R                   R                  S5      nU R                   R                  S5      nU R                   R                  S5      nU R                  Xs=L =(       a    Us=L =(       a	    UL 5        g s  5        g )Nr   r   r   r   )r=   r   rP   )r   r  opt2opt3opt4s        r   test_get_option_equals'TestOptionParser.test_get_option_equalsi  sw    {{%%d+{{%%k2{{%%d+{{%%i044444545r!   c                     U R                  U R                  R                  S5      5        U R                  U R                  R                  S5      5        g )Nr   r   )rP   r=   
has_optionr#   s    r   test_has_option TestOptionParser.test_has_optionp  s8    ..t45..{;<r!   c                 \   U R                  U R                  R                  S5      S L 5        U R                  U R                  R                  S5      S L 5        U R                  U R                  R                  S5      S L 5        U R                  U R                  R                  S5      S L 5        U R                  U R                  R	                  S5      5        U R                  U R                  R	                  S5      5        U R                  U R                  R	                  S5      5        U R                  U R                  R	                  S5      5        U R                  U R                  R	                  S5      5        U R                  U R                  R	                  S5      5        g )Nr   r   r   r   r   r   )rP   r=   r   r\   r  r#   s    r   assertTrueremoved"TestOptionParser.assertTrueremovedt  s,   ..t4<=..{;tCD..t4<=..y9TAB//56//<=//56//	:;..t45..z:;r!   c                 Z    U R                   R                  S5        U R                  5         g )Nr   r=   remove_optionr  r#   s    r   test_remove_short_opt&TestOptionParser.test_remove_short_opt  s     !!$' r!   c                 Z    U R                   R                  S5        U R                  5         g )Nr   r  r#   s    r   test_remove_long_opt%TestOptionParser.test_remove_long_opt  s     !!+. r!   c                 ^    U R                  U R                  R                  SS [        S5        g )Nr   zno such option 'foo')rY   r=   r  
ValueErrorr#   s    r   test_remove_nonexistent(TestOptionParser.test_remove_nonexistent  s&    $++33Xt$&<	>r!   zRelies on sys.getrefcountT)cpythonc                     S/n[         R                  " U5      n[        5       nUR                  SS5        Xl        UR                  5         AU R                  U[         R                  " U5      5        g )N*   -az	--aaarggh)rb   getrefcountr   r   	big_thingdestroyr@   )r   r$  refcountr=   s       r   test_refleakTestOptionParser.test_refleak  s\     D	??9-$,$3??9#=>r!   r   N)r&   r'   r(   r)   r   r   r   r  r	  r  r  r  r  r  r   impl_detailr'  r*   r+   r!   r   r   r   Q  sY    @C>/6=<!!> 4dC? D?r!   r   c                        \ rS rSrS rS rSrg)TestOptionValuesi  c                     g r   r+   r#   s    r   r   TestOptionValues.setUp  r   r!   c                    [        5       nU R                  [        U5      0 5        U R                  U0 5        U R                  USS05        U R                  US5        SSS.n[        US9nU R                  [        U5      U5        U R                  X5        U R                  USS05        U R                  U0 5        U R                  US5        U R                  U/ 5        g )Nr   r   r   r!  )r   baz)defaults)r   r@   r?   assertNotEqual)r   valuesdicts      r   test_basicsTestOptionValues.test_basics  s    fr*$FUEN3FB'R(&ft,&FUEN3FB'FB'FB'r!   r+   N)r&   r'   r(   r)   r   r4  r*   r+   r!   r   r+  r+    s    (r!   r+  c                   &    \ rS rSrS rS rS rSrg)TestTypeAliasesi  c                 "    [        5       U l        g r   )r   r=   r#   s    r   r   TestTypeAliases.setUp  s    "nr!   c                     U R                   R                  SSS9  U R                  U R                   R                  S5      R                  S5        g )N-srL   re   string)r=   r   r@   r   re   r#   s    r   test_str_aliases_string'TestTypeAliases.test_str_aliases_string  s>    t%0//5::HEr!   c                 P   U R                   R                  S[        S9  U R                  U R                   R	                  S5      R
                  S5        U R                   R                  S[        S9  U R                  U R                   R	                  S5      R
                  S5        g )Nr;  r<  r=  -xr   )r=   r   rL   r@   r   re   r   r#   s    r   test_type_object TestTypeAliases.test_type_object  sz    t#.//5::HEt#.//5::EBr!   r   N)r&   r'   r(   r)   r   r>  rB  r*   r+   r!   r   r7  r7    s    %FCr!   r7  r   <   i  iQ )smhdc                      US   R                  5       (       a  [        U5      $ [        US S 5      [        US      -  $ ! [        [        4 a    [        SU< SU< 35      ef = f)Nzoption z: invalid duration: )isdigitr   _time_unitsr  
IndexErrorr   optionoptvalues      r   _check_durationrR    sk    >9u:uSbz?[r%;;;
# >14e<> 	>>s   "A  A   $A$c                   t    \ rS rSr\R
                  S-   r\R                  " \R                  5      r\\S'   Sr	g)DurationOptioni  )durationrU  r+   N)
r&   r'   r(   r)   r	   TYPEScopyTYPE_CHECKERrR  r*   r+   r!   r   rT  rT    s.    LL=(E99V001L.Lr!   rT  c                   2    \ rS rSrS rS rS rS rS rSr	g)	TestDefaultValuesi  c                    [        5       U l        U R                  R                  SSSS9  U R                  R                  SSSS9  U R                  R                  S	S
SS9  U R                  R                  SS
S9  U R                  R                  SSS9  U R                  R                  S5        U R                  R                  SS S9  SSS SS S S.U l        g )Nr   r   Tdefaultr   r   r   )r   r   r   %   re   r]  z-mr<  r;  r   -tz-u)r   nrF  rE  tu)r   r=   r   expectedr#   s    r   r   TestDefaultValues.setUp  s    "nt[$?tYY?t%<t%0tU3t$tT2%)!#$##&r!   c                 l    U R                  U R                  R                  5       U R                  5        g r   )r@   r=   get_default_valuesrd  r#   s    r   test_basic_defaults%TestDefaultValues.test_basic_defaults  s#    7794==Ir!   c                     U R                   R                  SSS9  U R                  R                  SSS.5        U R	                  U R                   R                  5       U R                  5        g )Nr!  i)ra  rF  )r=   set_defaultsrd  updater@   rg  r#   s    r   test_mixed_defaults_post*TestDefaultValues.test_mixed_defaults_post  sQ      2 .2D127794==Ir!   c                 R   U R                   R                  SSS9  U R                   R                  SSS9  U R                   R                  S5        U R                  R	                  SSS.5        U R                  U R                   R                  5       U R                  5        U R                   R                  S5        U R                   R                  SS S9  U R                  R	                  SS 05        U R                  U R                   R                  5       U R                  5        g )	Nbarfblah)xyrA  frobr\  z-yrs  )r=   rk  r   rd  rl  r@   rg  r  r#   s    r   test_mixed_defaults_pre)TestDefaultValues.test_mixed_defaults_pre  s      6V 4tV4t$6787794==I!!$'tT2c4[)7794==Ir!   c                 N   [         U R                  l        U R                  R                  SSSS9  U R                  R                  SSSS9  U R                  R	                  SS9  U R
                  R                  SS	S
S.5        U R                  U R                  R                  5       U R
                  5        U R                  R                  S5        U R
                  R                  SSSS.5        U R                  U R                  R                  5       U R
                  5        g )Nr   rU  i,  r_  z-e6m42)ra  ih  r!  )rH  era  F)
rT  r=   option_classr   rk  rd  rl  r@   rg  set_process_default_valuesr#   s    r   test_process_default&TestDefaultValues.test_process_default  s    #1 t*cBt*dC  4 (3Sr:;7794==I..u53T=>7794==Ir!   )rd  r=   N)
r&   r'   r(   r)   r   rh  rm  ru  r}  r*   r+   r!   r   rZ  rZ    s    & JJ
J
Jr!   rZ  c                   0    \ rS rSrSrS rS rS rS rSr	g)	TestProgNamei	  zQ
Test that %prog expands to the right thing in usage, version,
and help strings.
c                 D    U R                  UR                  5       U5        g r   )r@   	get_usager   r=   expected_usages      r   assertUsageTestProgName.assertUsage  s    ))+^<r!   c                 D    U R                  UR                  5       U5        g r   )r@   get_version)r   r=   expected_versions      r   assertVersionTestProgName.assertVersion  s    ++-/?@r!   c                 t   [         R                  S S  n [        R                  R	                  SSS5      [         R                  S'   [        SSS9nSnU R                  X#5        U R                  US	5        U R                  UUS
-   S-   5        U[         R                  S S & g ! U[         R                  S S & f = f)Nr   r   zbaz.pyr   z	%prog ...z	%prog 1.2)versionzUsage: baz.py ...
z
baz.py 1.2
zlOptions:
  --version   show program's version number and exit
  -h, --help  show this help message and exit
)	rb   argvospathjoinr   r  r  ru   )r   	save_argvr=   r  s       r   test_default_progname"TestProgName.test_default_progname  s    HHQK		$'',,ueX>CHHQK!+{CF2NV4v|4OOF*T1NNO $CHHQK)CHHQKs   A9B" "B7c                     [        SSSS9nUR                  S5        UR                  S5        SnU R                  X5        U R                  US5        U R	                  XS	-   5        g )
Nthingy	%prog 0.1z%prog arg arg)progr  r}   -h	--versionzUsage: thingy arg arg
z
thingy 0.1r  )r   r  r  r  ru   r  s      r   test_custom_progname!TestProgName.test_custom_progname'  sf    8&1$35 	T"[)206<0 56r!   r+   N)
r&   r'   r(   r)   __doc__r  r  r  r  r*   r+   r!   r   r  r  	  s    
=A$"	7r!   r  c                   P    \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rSrg)TestExpandDefaultsi3  c                     [        SS9U l        SU l        SU l        U R                  S-   U l        U R                  S-   U l        g )Ntest)r  zXUsage: 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   r=   help_prefix	file_helpexpected_help_fileexpected_help_noner#   s    r   r   TestExpandDefaults.setUp4  sO    "/ >"&"2"2I#J"&"2"2F#Gr!   c                     U R                   R                  SSSU R                  S9  U R                  U R                   U R                  5        g )N-f--filefoo.txtr]  help)r=   r   r  ru   r  r#   s    r   test_option_default&TestExpandDefaults.test_option_defaultB  sA    tX'0$(NN 	 	4 	T%<%<=r!   c                     U R                   R                  SSU R                  S9  U R                   R                  SS5        U R	                  U R                   U R
                  5        g )Nr  r  r  filer  )r=   r   r  set_defaultru   r  r#   s    r   test_parser_default_1(TestExpandDefaults.test_parser_default_1H  sP    tX$(NN 	 	4	2T%<%<=r!   c                     U R                   R                  SSU R                  S9  U R                   R                  SS9  U R	                  U R                   U R
                  5        g )Nr  r  r  r  r  )r=   r   r  rk  ru   r  r#   s    r   test_parser_default_2(TestExpandDefaults.test_parser_default_2N  sQ    tX$(NN 	 	4  i 0T%<%<=r!   c                     U R                   R                  SSU R                  S9  U R                  U R                   U R                  5        g )Nr  r  r  r=   r   r  ru   r  r#   s    r   test_no_default"TestExpandDefaults.test_no_defaultT  s<    tX$(NN 	 	4T%<%<=r!   c                     U R                   R                  SSS U R                  S9  U R                  U R                   U R                  5        g )Nr  r  r  r  r#   s    r   test_default_none_1&TestExpandDefaults.test_default_none_1Y  sA    tX'+$(NN 	 	4 	T%<%<=r!   c                     U R                   R                  SSU R                  S9  U R                   R                  S S9  U R	                  U R                   U R
                  5        g )Nr  r  r  r  )r=   r   r  rk  ru   r  r#   s    r   test_default_none_2&TestExpandDefaults.test_default_none_2_  sQ    tX$(NN 	 	4  d +T%<%<=r!   c                     U R                   R                  SSSS9  U R                   R                  SS9  U R                  S-   nU R	                  U R                   U5        g )N-pz--probz1blow up with probability PROB [default: %default]r  g      ?)probzF  -p PROB, --prob=PROB  blow up with probability PROB [default: 0.25]
)r=   r   rk  r  ru   r   rs   s     r   test_float_default%TestExpandDefaults.test_float_defaulte  s_    (D 	 	F 	  d +((UV]3r!   c                     U R                   R                  SSSSS9  SU R                   R                  l        U R	                  U R                   U R
                  5        g )Nr  r  r  z#read from FILE [default: *DEFAULT*]r  z	*DEFAULT*)r=   r   	formatterdefault_tagru   r  r#   s    r   test_alt_expand"TestExpandDefaults.test_alt_expandn  sP    tX'0$I 	 	K -8)T%<%<=r!   c                     U R                   R                  SSSSS9  S U R                   R                  l        U R                  S-   nU R                  U R                   U5        g )Nr  r  r  zread from %default filer  z0  -f FILE, --file=FILE  read from %default file
)r=   r   r  r  r  ru   r  s     r   test_no_expand!TestExpandDefaults.test_no_expandu  s]    tX'0$= 	 	? -1)((?@]3r!   )r  r  r  r  r=   N)r&   r'   r(   r)   r   r  r  r  r  r  r  r  r  r  r*   r+   r!   r   r  r  3  s5    G>>>>
>>4>4r!   r  c                       \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rSrg)TestStandardi  c                 h    [        SSS9[        SSSSS9[        S	S
S9/n[        [        US9U l        g )Nr"  r=  r<  r   --boor   boore   r   --fooappendr   r}   option_listr   r-   r   r=   r   rE   s     r   r   TestStandard.setUp  s?    t(3tW5uEwx8: /^;BDr!   c                 *    U R                  S/S5        g )Nr"  z-a option requires 1 argumentr_   r#   s    r   test_required_value TestStandard.test_required_value  s    dV%DEr!   c                 ,    U R                  SS/S5        g )Nr   5xz&option -b: invalid integer value: '5x'r  r#   s    r   test_invalid_integer!TestStandard.test_invalid_integer  s    dD\E	Gr!   c                 *    U R                  S/S5        g )Nz--boo13zno such option: --boo13r  r#   s    r   test_no_such_option TestStandard.test_no_such_option  s    i[*CDr!   c                 *    U R                  S/S5        g )Nz--boo=x5z)option --boo: invalid integer value: 'x5'r  r#   s    r   test_long_invalid_integer&TestStandard.test_long_invalid_integer  s    j\H	Jr!   c                 2    U R                  / S S S S./ 5        g )Nar  r   rH   r#   s    r   
test_emptyTestStandard.test_empty  s    2T$tDbIr!   c                 :    U R                  / SQSS SS/S./ 5        g )N)r"  r   z
--foo=blahz--foo=r   rq  r  r  r#   s    r   "test_shortopt_empty_longopt_append/TestStandard.test_shortopt_empty_longopt_append  s$    =!#D&"F	r!   c                 :    U R                  / SQS S / SQS./ 5        g )N)r  r   r  r   z--foo=x)r   r   rr  r  r  r#   s    r   test_long_option_append$TestStandard.test_long_option_append  s&    C!%#'#35 		r!   c                 4    U R                  S/SS S S./ 5        g )Nz-abcbcr  r  r#   s    r   test_option_argument_joined(TestStandard.test_option_argument_joined  s!    F8!%d4@	r!   c                 6    U R                  SS/SS S S./ 5        g )Nr"  34r  r  r#   s    r   test_option_argument_split'TestStandard.test_option_argument_split  s#    D$<!%d4@	r!   c                 4    U R                  S/S SS S./ 5        g )Nz-b34"   r  r  r#   s    r   #test_option_argument_joined_integer0TestStandard.test_option_argument_joined_integer  s!    F8!%b>	r!   c                 6    U R                  SS/S SS S./ 5        g )Nr   -5r  r  r#   s    r   +test_option_argument_split_negative_integer8TestStandard.test_option_argument_split_negative_integer  s#    D$<!%b>	r!   c                 4    U R                  S/S SS S./ 5        g )Nz--boo=13   r  r  r#   s    r    test_long_option_argument_joined-TestStandard.test_long_option_argument_joined  s!    J<!%b>	r!   c                 6    U R                  SS/S SS S./ 5        g )Nr  111o   r  r  r#   s    r   test_long_option_argument_split,TestStandard.test_long_option_argument_split  s$    GU+!%c$?	r!   c                 8    U R                  SS/SS S/S./ 5        g )N	--foo=bar-axyzxyzr   r  r  r#   s    r   test_long_option_short_option*TestStandard.test_long_option_short_option  s&    K1!&tUGD	r!   c                 8    U R                  SS/SS S/S./ 5        g )N--f=barr  r  r   r  r  r#   s    r   test_abbrev_long_option$TestStandard.test_abbrev_long_option  s&    Iw/!&tUGD	r!   c                     U R                   R                  / 5      u  pU R                   R                  5       nU R                  [	        U5      [	        U5      5        g r   )r=   r>   rg  r@   r?   )r   rE   rB   r0  s       r   test_defaultsTestStandard.test_defaults  sB    ++004;;113hg7r!   c                 b    U R                   R                  SSSSS9  U R                  S/S5        g )N--fozr   r=  r   r   re   r   r  z%ambiguous option: --f (--foo, --foz?)r=   r   r_   r#   s    r   test_ambiguous_option"TestStandard.test_ambiguous_option  s8    ww$,5 	 	:i[D	Fr!   c                 8    U R                  / SQSS S/S./ 5        g )N)r"  r  r  r   r  r   r  r  r#   s    r    test_short_and_long_option_split-TestStandard.test_short_and_long_option_split  s"    8!&tUGD	r!   c                 :    U R                  / SQS SSS/S./ 5        g )N)r  r   123r  r/  {   r   r/  r  r  r#   s    r   *test_short_option_split_long_option_append7TestStandard.test_short_option_split_long_option_append  s$    E!%c5%.I	r!   c                 8    U R                  / SQSS S S.S/5        g )N)r"  r   r   r   r  r   r  r#   s    r   *test_short_option_split_one_positional_arg7TestStandard.test_short_option_split_one_positional_arg  s"    /!&tDA!7	$r!   c                 n    U R                  / SQSS S S.SS/5        U R                  / SQSS S/S./ 5        g )N)r"  r   r   r   r   r  r   r   )r"  r   r  r   r  r#   s    r   $test_short_option_consumes_separator1TestStandard.test_short_option_consumes_separator  sF    5!%d4@!5>	+ 	7!%dE7C	r!   c                 <    U R                  / SQSS S S.SS/5      4  g )N)-abr   r  r   r   r  r  r   r  r#   s    r   &test_short_option_joined_and_separator3TestStandard.test_short_option_joined_and_separator  s*    8!$T$?#U+	- 	.r!   c                 :    U R                  / SQSS S/S.S/5        g )N)r6  -r  r   r   r   r  r:  r  r#   s    r   "test_hyphen_becomes_positional_arg/TestStandard.test_hyphen_becomes_positional_arg  s$    7!$T5'B5	"r!   c                 :    U R                  / SQS SSS/S./ 5        g )N)-b3r   5r  r  r/     r   r/  r  r  r#   s    r   test_no_append_versus_append)TestStandard.test_no_append_versus_append  s$    J!%aG	r!   c                 6    U R                  SS/SS S S./ 5        g )Nr"  r>  r  r  r#   s    r   &test_option_consumes_optionlike_string3TestStandard.test_option_consumes_optionlike_string  s#    D%=!&tDA	r!   c                 ^    U R                   R                  SSS9  U R                  S/S5        g )Nr`  r   r  z-testzno such option: -er$  r#   s    r   #test_combined_single_invalid_option0TestStandard.test_combined_single_invalid_option  s.    tL9gY1	3r!   r   N) r&   r'   r(   r)   r   r  r  r  r  r  r  r  r  r   r  r	  r  r  r  r  r  r%  r(  r-  r0  r3  r7  r;  rA  rD  rG  r*   r+   r!   r   r  r    s    DFGEJJ








8
F

$
.
"


3r!   r  c                   2    \ rS rSrS rS rS rS rS rSr	g)	TestBooli  c                 R    [        SSSSSS9[        SSS	SS
9/n[        US9U l        g )Nr   r   r   r   r   r   r   r]  r   r   r   r   r  )r   r   r=   r  s     r   r   TestBool.setUp  sB    t*&2$-')	+
 t(&3$-/0 #9r!   c                 .    U R                  / SS0/ 5        g )Nr   r   r  r#   s    r   test_bool_defaultTestBool.test_bool_default  s    2%r?	r!   c                 n    U R                  S/SS0/ 5      u  pU R                  UR                  SL 5        g )Nr   r   r   FrH   rP   r   r   rE   rB   s      r   test_bool_falseTestBool.test_bool_false  s9    ,,dV.7^-/1 	501r!   c                 n    U R                  S/SS0/ 5      u  pU R                  UR                  SL 5        g )Nr   r   r   TrS  rT  s      r   test_bool_trueTestBool.test_bool_true#  s9    ,,dV.7^-/1 	4/0r!   c                 2    U R                  / SQSS0/ 5        g )N)z-qvqr   r   r   r   r  r#   s    r   test_bool_flicker_on_and_off%TestBool.test_bool_flicker_on_and_off)  s    /%q>	r!   r   N)
r&   r'   r(   r)   r   rP  rU  rX  r[  r*   r+   r!   r   rJ  rJ    s    
:
21r!   rJ  c                   ,    \ rS rSrS rS rS rS rSrg)
TestChoicei.  c                 f    [        [        S9U l        U R                  R                  SSSS/ SQS9  g )Nr|   -cr   r   )onetwothree)r   re   r   r   r-   r   r=   r   r#   s    r   r   TestChoice.setUp/  s2    .^DtG($,6M 	 	Or!   c                 4    U R                  / SQSS0S/5        g )N)r`  ra  r  r   ra  r  r  r#   s    r   test_valid_choiceTestChoice.test_valid_choice4  s     /$e,!7	$r!   c                 ,    U R                  / SQS5        g )N)r`  fourabczEoption -c: invalid choice: 'four' (choose from 'one', 'two', 'three')r  r#   s    r   test_invalid_choiceTestChoice.test_invalid_choice9  s    2C	Dr!   c                     U R                   R                  SS/ SQS9  U R                   R                  S5      nU R                  UR                  S5        U R                  UR
                  S5        g )Nr   z	--default)rj  fivesix)r   r   r   )r=   r   r   r@   re   r   r   rP  s     r   test_add_choice_option!TestChoice.test_add_choice_option>  s]    t['> 	 	@kk$$T*8,W-r!   r   N)	r&   r'   r(   r)   r   rg  rl  rr  r*   r+   r!   r   r^  r^  .  s    O
$
D
.r!   r^  c                   h    \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rSrg)	TestCountiE  c                    [        [        S9U l        [        SSSS9U l        U R                  R                  U R                  5        U R                  R                  SSSS9  U R                  R                  S	S
SSSS9  g )Nr|   r   r   r   r   r   r   r  r   r   store_constr   r   r   r   )r-   r   r=   r   v_optr   r#   s    r   r   TestCount.setUpF  sp    .^D gIF
tzz*{YGtY&3)1 	 	Nr!   c                 .    U R                  / SS 0/ 5        g )Nr   r  r#   s    r   r  TestCount.test_emptyN  s    2	40"5r!   c                 0    U R                  S/SS0/ 5        g )Nr   r   r   r  r#   s    r   test_count_oneTestCount.test_count_oneQ  s    D6Iq>26r!   c                 0    U R                  S/SS0/ 5        g )N-vvvr      r  r#   s    r   test_count_threeTestCount.test_count_threeT  s    F8i^R8r!   c                 2    U R                  / SQSS0/ 5        g )N)r   r   r   r   r  r  r#   s    r   test_count_three_apart TestCount.test_count_three_apartW  s    -	1~rBr!   c                 2    U R                  SS/SS0/ 5        g )Nr  --verbose=2r   r   r  r#   s    r   test_count_override_amount$TestCount.test_count_override_amountZ  s    FM2YNBGr!   c                 2    U R                  / SQSS0/ 5        g )N)r  r  r   r   r   r  r#   s    r   test_count_override_quiet#TestCount.test_count_override_quiet]  s    89a."Mr!   c                 2    U R                  / SQSS0/ 5        g )Nr  r  r   r   r   r   r  r#   s    r   test_count_overridingTestCount.test_count_overriding`  s    >%q>2	/r!   c                 4    U R                  / SQSS0S/5        g )Nr   3r   r   r   r  r  r#   s    r   test_count_interspersed_args&TestCount.test_count_interspersed_argsd  s    1%q>5	"r!   c                 j    U R                   R                  5         U R                  / SQSS0SS/5        g )Nr  r   r   r  r   )r=   disable_interspersed_argsrH   r#   s    r   test_count_no_interspersed_args)TestCount.test_count_no_interspersed_argsi  s1    --/1%q>;	(r!   c                 ,    U R                  SS/S5        g )Nz-q3r   zno such option: -3r  r#   s    r   test_count_no_such_option#TestCount.test_count_no_such_optiono  s    eT],@Ar!   c                 ,    U R                  SS/S5        g )Nz	--quiet=3r   z$--quiet option does not take a valuer  r#   s    r   test_count_option_no_value$TestCount.test_count_option_no_valuer  s    k40C	Er!   c                 f    U R                   R                  SS5        U R                  / SS0/ 5        g )Nr   r   r=   r  rH   r#   s    r   test_count_with_default!TestCount.test_count_with_defaultv  s,    	1-2	!}b1r!   c                 j    U R                   R                  SS5        U R                  / SQSS0/ 5        g )Nr   r   r  r   r  r#   s    r   test_count_overriding_default'TestCount.test_count_overriding_defaultz  s0    	1->%q>2	/r!   )r=   ry  N)r&   r'   r(   r)   r   r  r~  r  r  r  r  r  r  r  r  r  r  r  r*   r+   r!   r   ru  ru  E  sN    N679CHN/"
(BE2/r!   ru  c                   2    \ rS rSrS rS rS rS rS rSr	g)	TestMultipleArgsi  c           	      d    [        [        S9U l        U R                  R                  SSSSSSS9  g )	Nr|   r  --pointr   r  floatpointr   r   re   r   rd  r#   s    r   r   TestMultipleArgs.setUp  s3    .^DtY&-QW7 	 	Tr!   c                 6    U R                  / SQSS0SS/5        g )N)r   r  12.5z-4.3r  r  )g      ?      @g333333r   r  r  r#   s    r   test_nargs_with_positional_args0TestMultipleArgs.test_nargs_with_positional_args  s#    C#%56!5>	+r!   c                 4    U R                  / SQSS0S/5        g )N)r  -1r  z-0r  r  )g      r  g       r  r  r#   s    r   test_nargs_long_opt$TestMultipleArgs.test_nargs_long_opt  s!    @#%67!7	$r!   c                 ,    U R                  / SQS5        g )N)r  1.02x3.5z-option -p: invalid floating-point value: '2x'r  r#   s    r   test_nargs_invalid_float_value/TestMultipleArgs.test_nargs_invalid_float_value  s    7B	Cr!   c                 ,    U R                  / SQS5        g )N)r  r  r  z#--point option requires 3 argumentsr  r#   s    r   test_nargs_required_values+TestMultipleArgs.test_nargs_required_values  s    6B	Dr!   r   N)
r&   r'   r(   r)   r   r  r  r  r  r*   r+   r!   r   r  r    s    T
+
$
C
Dr!   r  c                   2    \ rS rSrS rS rS rS rS rSr	g)	TestMultipleArgsAppendi  c           	          [        [        S9U l        U R                  R                  SSSSSSS9  U R                  R                  S	S
SSSSS9  U R                  R                  SSSSSS9  g )Nr|   r  r  r   r  r  r  r  r  r  r  r   r   r   -z--zeroappend_constr   r   rx  rd  r#   s    r   r   TestMultipleArgsAppend.setUp  sx    .^DtYwa$+' 	 	;tWXQ$) 	 	7tXn$) 	 	9r!   c                 :    U R                  / SQS SS/S.S/5        g )N)r  4-3rq  r  r  666)   )r   i  r  r   rq  r  r#   s    r   test_nargs_append(TestMultipleArgsAppend.test_nargs_append  s%    I%)7H2EF"8	%r!   c                 *    U R                  S/S5        g )Nz-f4,3z-f option requires 2 argumentsr  r#   s    r   !test_nargs_append_required_values8TestMultipleArgsAppend.test_nargs_append_required_values  s    gY=	?r!   c                 6    U R                  SS/S S/S./ 5        g )Nz--foo=3r  r  r  r  r  r#   s    r   test_nargs_append_simple/TestMultipleArgsAppend.test_nargs_append_simple  s$    Is+%)&:	r!   c                 8    U R                  / SQS / SQS./ 5        g )N)r  r  r  r  r  )r  r  r  r  r  r#   s    r   test_nargs_append_const.TestMultipleArgsAppend.test_nargs_append_const  s    >%)1IJ	r!   r   N)
r&   r'   r(   r)   r   r  r  r  r  r*   r+   r!   r   r  r    s    9%
?
r!   r  c                        \ rS rSrS rS rSrg)TestVersioni  c                 N   [        [        SS9U l        [        R                  S S  n [
        R                  R                  [
        R                  SS5      [        R                  S'   U R                  S/S5        U[        R                  S S & g ! U[        R                  S S & f = f)Nr  )r}   r  r   r   r   r  zbar 0.1
)
r-   r   r=   rb   r  r  r  r  curdirrj   )r   r  s     r   test_versionTestVersion.test_version  su    .^7BDHHQK		$'',,ryy%?CHHQK{m[9#CHHQK)CHHQKs   AB B$c                 N    [        [        S9U l        U R                  S/S5        g )Nr|   r  zno such option: --version)r-   r   r=   r_   r#   s    r   test_no_versionTestVersion.test_no_version  s#    .^Dk]8	:r!   r   N)r&   r'   r(   r)   r  r  r*   r+   r!   r   r  r    s    $:r!   r  c                   *    \ rS rSrSrS rS rS rSrg)TestConflictingDefaultsi  z4Conflicting default values: the last one should win.c           	      6    [        [        SSSSS9/S9U l        g )Nr   r   r   r   rL  rM  )r   r   r=   r#   s    r   r   TestConflictingDefaults.setUp  s#    "\	1M0O Pr!   c                 f    U R                   R                  SSSSS9  U R                  / SS0/ 5        g )Nr   r   r   r   rL  r=   r   rH   r#   s    r   test_conflict_default-TestConflictingDefaults.test_conflict_default  s8    tM	'( 	 	*2	1~r2r!   c                 f    U R                   R                  SSSS S9  U R                  / SS 0/ 5        g )Nr   r   r   rL  r  r#   s    r   test_conflict_default_none2TestConflictingDefaults.test_conflict_default_none  s9    tM	'+ 	 	-2	40"5r!   r   N)	r&   r'   r(   r)   r  r   r  r  r*   r+   r!   r   r  r    s    >P3
6r!   r  c                   8    \ rS rSrS rS rS rS rS rS r	Sr
g	)
TestOptionGroupi  c                 (    [        [        S9U l        g r{   r~   r#   s    r   r   TestOptionGroup.setUp  r   r!   c                     [        U R                  S5      nU R                  R                  U5        UR                  SSSS9  U R	                  S/SS0/ 5        g )NSpamz--spamr   zspam spam spam spamr   r  spamr   )r   r=   add_option_groupr   rH   r   groups     r   !test_option_group_create_instance1TestOptionGroup.test_option_group_create_instance  sV    DKK0$$U+,3 	 	5H:{B7r!   c                 R    U R                  U R                  R                  SS 5        g )Nz!not an OptionGroup instance: Nonern   r=   r  r#   s    r   test_add_group_no_group'TestOptionGroup.test_add_group_no_group  s"    T[[99@$	Hr!   c                 T    U R                  U R                  R                  SS S 5        g r   r  r#   s    r    test_add_group_invalid_arguments0TestOptionGroup.test_add_group_invalid_arguments  s#    T[[990$	>r!   c                     [        U R                  S5      n[        5       Ul        U R                  U R                  R                  U4S [
        S5        g )Nr  z"invalid OptionGroup (wrong parser))r   r=   r   rY   r  r  r  s     r   test_add_group_wrong_parser+TestOptionGroup.test_add_group_wrong_parser  sB    DKK0#~$++66$$&J	Lr!   c                     U R                   R                  SSS9nUR                  S5        UR                  SSS9  U R	                  U R                   R                  S5      U5        g )NzGroup 2zSome more options)descriptionBaconz--baconr   r<  )r=   r  	set_titler   rP   get_option_groupr  s     r   test_group_manipulate%TestOptionGroup.test_group_manipulate  s]    ,,Y9L - N /44Y?Gr!   r   N)r&   r'   r(   r)   r   r  r  r  r  r  r*   r+   r!   r   r  r    s#    98H>LHr!   r  c                   H    \ rS rSrS rS r " S S\5      rS rS r	S r
S	rg
)TestExtendAddTypesi  c                     [        [        U R                  S9U l        U R                  R	                  SS SSS9  U R                  R	                  SSSSS9  g )	N)r}   r{  r"  r=  r  r  r  r  r  )r-   r   MyOptionr=   r   r#   s    r   r   TestExtendAddTypes.setUp  sN    .^<@MMKtTsCtXFHr!   c                 `   [         R                  R                  [        R                  5      (       a%  [         R
                  " [        R                  5        g [         R                  R                  [        R                  5      (       a%  [         R                  " [        R                  5        g g r   )r  r  isdirr   TESTFNrmdirisfileunlinkr#   s    r   tearDownTestExtendAddTypes.tearDown   s]    77==))**HHY%%&WW^^I,,--IIi&&' .r!   c                   z    \ rS rSrS r\R                  S-   r\R                  " \R                  5      r\\S'   Sr	g)TestExtendAddTypes.MyOptioni  c                     [         R                  R                  U5      (       d  [        SU-  5      e[         R                  R	                  U5      (       d  [        SU-  5      eU$ )N%s: file does not exist%s: not a regular file)r  r  existsr   r  rN  s      r   
check_file&TestExtendAddTypes.MyOption.check_file  sO    77>>%((&'@5'HIIWW^^E**&'?%'GHHLr!   r  r  r+   N)
r&   r'   r(   r)   r$  r	   rV  rW  rX  r*   r+   r!   r   r  r    s5    	 y(yy!4!45)Vr!   r  c                     [         R                  " [         R                  5        U R                  S[         R                  S/[         R                  SS./ 5        g )Nr  -afoor   )r  r  )r   create_empty_filer  rH   r#   s    r   test_filetype_ok#TestExtendAddTypes.test_filetype_ok  sD    ##I$4$45Hi&6&6@$-$4$45A	r!   c                 l    U R                  S[        R                  S/S[        R                  -  5        g )Nr  r'  r!  )r_   r   r  r#   s    r   test_filetype_noexist(TestExtendAddTypes.test_filetype_noexist  s0    h	(8(8'B6&--.	/r!   c                     [         R                  " [        R                  5        U R	                  S[        R                  S/S[        R                  -  5        g )Nr  r'  r"  )r  mkdirr   r  r_   r#   s    r   test_filetype_notfile(TestExtendAddTypes.test_filetype_notfile  sB    
!!"h	(8(8'B5&--.	/r!   r   N)r&   r'   r(   r)   r   r  r	   r  r)  r,  r0  r*   r+   r!   r   r  r    s(    I(
*F 
*/
/r!   r  c                   <    \ rS rSrS r " S S\5      rS rS rSr	g)	TestExtendAddActionsi$  c                 H    U R                  SSSSSS9/n[        US9U l        g )Nr"  --appleextendr=  appler#  rM  )r  r   r=   r  s     r   r   TestExtendAddActions.setUp%  s1    ==y&.W ! > ?"w7r!   c                   t    \ rS rSr\R
                  S-   r\R                  S-   r\R                  S-   rS rSr	g)TestExtendAddActions.MyOptioni*  )r6  c           	          US:X  a3  UR                  S5      nUR                  U/ 5      R                  U5        g [        R                  " XX#XdU5        g )Nr6  ,)splitensure_valuer6  r	   take_action)r   r   r   rP  rQ  r2  r=   lvalues           r   r?  )TestExtendAddActions.MyOption.take_action/  sJ    !S)##D"-44V<""4F#)+r!   r+   N)
r&   r'   r(   r)   r	   ACTIONSSTORE_ACTIONSTYPED_ACTIONSr?  r*   r+   r!   r   r  r:  *  s5    ..;.,,{:,,{:	+r!   r  c                 6    U R                  SS/S/ SQ0/ 5        g )Nz	-afoo,barz--apple=blahr7  )r   r   rq  r  r#   s    r   test_extend_add_action+TestExtendAddActions.test_extend_add_action7  s#    K8#%;<	r!   c                 6    U R                  / SQS/ SQ0/ 5        g )N)r"  r   z-abarz--apple=x,yr7  )r   r   rr  rs  r  r#   s    r   test_extend_add_action_normal2TestExtendAddActions.test_extend_add_action_normal<  s    @#%=>	r!   r   N)
r&   r'   r(   r)   r   r	   r  rF  rI  r*   r+   r!   r   r3  r3  $  s    8
+F +
r!   r3  c                   ,    \ rS rSrS rS rS rS rSrg)TestCallbackiC  c           
      |    [        SS SU R                  S9[        SSSU R                  SSS9/n[        US	9U l        g )
NrA  r   r   r  r  r=  filename)r   r   re   r   rM  )r   process_optr   r=   r  s     r   r   TestCallback.setUpD  sQ    t#&0(,(8(8: t'&0(,(8(8$,$.0		1 #w7r!   c                    US:X  a  U R                  UR                  S/5        U R                  UR                  / 5        U R                  X@R                  L 5        U R                  US L 5        U R                  [        UR                  5      SS 05        SUR                  l        g US:X  a  U R                  UR                  S/5        U R                  UR                  S/5        U R                  X@R                  L 5        U R                  US5        U R                  [        UR                  5      S SS.5        [        UR                  UR                  U5        g U R                  SU-  5        g )	NrA  rN  r!  r  r  r   rN  rr  z!Unknown option %r in process_opt.)r@   r   r  rP   r=   r?   r2  rr  setattrr   rK   r   rO  rP  rQ  parser_s        r   rO  TestCallback.process_optQ  s"   $;V//$8V..3OOG{{23OOETM*T'..1J3EF!GNNH_V//$8V..
;OOG{{23UE*T'..123NOGNNFKK7II9C?@r!   c                 4    U R                  SS/SSS./ 5        g )NrA  z
--file=foor   r!  rR  r  r#   s    r   test_callbackTestCallback.test_callbacke  s"    D,/(-B7	r!   c           	          [        [        S9nUR                  S5        UR                  SSSS SSS	9  S
nU R	                  X5        g )Nr|   r  r`  z--testr   c                      g r   r+   r+   r!   r   <lambda>1TestCallback.test_callback_help.<locals>.<lambda>q  s    4r!   r=  r   )r   r   re   r  z%Options:
  -t TEST, --test=TEST  foo
)r   r   r  r   ru   )r   r=   rs   s      r   test_callback_helpTestCallback.test_callback_helpj  sP     N3T"$#/h$ 	 	&9.r!   r   N)	r&   r'   r(   r)   r   rO  rX  r^  r*   r+   r!   r   rL  rL  C  s    8A(
/r!   rL  c                   &    \ rS rSrS rS rS rSrg)TestCallbackExtraArgsiy  c                 b    [        SSSU R                  S[        4SS/ S9/n[        US9U l        g )	Nr  r  r   r  r=  points)r   r   r   re   r   r]  rM  )r   process_tupler   r   r=   r  s     r   r   TestCallbackExtraArgs.setUpz  s<    tYz(,(:(:./XH$,b: ; #w7r!   c                 \   U R                  US5        U R                  U[        L 5        US:X  a  U R                  US5        OUS:X  a  U R                  US5        [        [	        XcR                  S5      5      5      n[        UR                  UR                  5      R                  U5        g )Nr  r  z1,2,3r  4,5,6r<  )
r@   rP   r   r   mapr=  getattrr2  r   r  )r   rO  rP  rQ  rU  lenre   s          r   rd  #TestCallbackExtraArgs.process_tuple  s    a $$;UG,IUG,c$C 012,33E:r!   c                 6    U R                  / SQSSS/0/ 5        g )N)z-p1,2,3r  rg  rc  r   r   r  )r  r@     r  r#   s    r   test_callback_extra_args.TestCallbackExtraArgs.test_callback_extra_args  s#    :$w&89	r!   r   N)r&   r'   r(   r)   r   rd  ro  r*   r+   r!   r   ra  ra  y  s    8
;r!   ra  c                   ,    \ rS rSrS rS rS rS rSrg)TestCallbackMeddleArgsi  c           
          [        SSS5       Vs/ s H"  n[        [        U5      SU R                  SS9PM$     nn[	        US9U l        g s  snf )NrJ  ir   thingsr   r   r   rM  )ranger   rL   	process_nr   r=   )r   rr  rE   s      r   r   TestCallbackMeddleArgs.setUp  sW     ""b"-/-q s1vj(,XG- 	 / #w7/s   )A
c                 F   [        USS  5      nUR                  n[        U5      U:  a  U R                  SXR4-  5        UR                  R                  UR                  / 5      nUR                  [        USU 5      5        UR                  R                  U5        USU2	 g )Nr   z$Expected %d arguments for %s option.r   )
r   rargsrj  rK   r2  r>  r   r  r   largs)r   rO  rP  rQ  rU  r   rz  r   s           r   rw   TestCallbackMeddleArgs.process_n  s    CGu:II<|KL~~**6;;;E%%.)*U#!E'Nr!   c                 :    U R                  / SQSSS/0SS/5        g )N)r  r   r  r   r/  quxrt  r  )r   r/  r~  r   r  r  r#   s    r   test_callback_meddle_args0TestCallbackMeddleArgs.test_callback_meddle_args  s(    C$x1F&GHq6	#r!   c                 6    U R                  / SQSS/0S/5        g )N)z-2r   r   rt  )r   r   r   r  r#   s    r   #test_callback_meddle_args_separator:TestCallbackMeddleArgs.test_callback_meddle_args_separator  s"    .$}o63	 r!   r   N)	r&   r'   r(   r)   r   rw  r  r  r*   r+   r!   r   rr  rr    s    8	#
 r!   rr  c                   &    \ rS rSrS rS rS rSrg)TestCallbackManyArgsi  c           
          [        SSSSU R                  SS9[        SSSS	U R                  S
S9/n[        US9U l        g )Nr"  r5  r   r   r=  )r   r   r   re   r   --bobr  r   rM  )r   process_manyr   r=   r  s     r   r   TestCallbackManyArgs.setUp  sP    tYz(,(9(9JtWZq(,(9(9GH #w7r!   c                     US:X  a  U R                  US5        g US:X  a  U R                  US5        g US:X  a  U R                  US5        g US:X  a  U R                  US5        g g )	Nr"  r   r5  )dingdongr   rm  r  )ifr!  r   r@   rT  s        r   r  !TestCallbackManyArgs.process_many  se    $;UN3IU$45D[UI.G^UM2 r!   c                 4    U R                  / SQS S S./ 5        g )N)r"  r   r   r5  r  r  r   r  2r  r  z-666ry  0)r7  bobr  r#   s    r   test_many_args#TestCallbackManyArgs.test_many_args  s"     ! &*$7		r!   r   N)r&   r'   r(   r)   r   r  r  r*   r+   r!   r   r  r    s    83r!   r  c                   &    \ rS rSrS rS rS rSrg)TestCallbackCheckAbbrevi  c                 l    [        5       U l        U R                  R                  SSU R                  S9  g )N	--foo-barr   r   )r   r=   r   check_abbrevr#   s    r   r   TestCallbackCheckAbbrev.setUp  s/    "n{:(,(9(9 	 	;r!   c                 (    U R                  US5        g )Nr  r  r   rO  rP  rQ  r=   s        r   r  $TestCallbackCheckAbbrev.check_abbrev  s    k*r!   c                 ,    U R                  S/0 / 5        g )Nr  r  r#   s    r   test_abbrev_callback_expansion6TestCallbackCheckAbbrev.test_abbrev_callback_expansion  s    G9b"-r!   r   N)r&   r'   r(   r)   r   r  r  r*   r+   r!   r   r  r    s    ;
+.r!   r  c                   >    \ rS rSrS rS rS rS rS rS r	S r
S	rg
)TestCallbackVarArgsi  c           
          [        SSSSS9[        SSSS	9[        S
SSU R                  SS9/n[        [        US9U l        g )Nr"  r   r   r  )re   r   r   r   r   r   r   r`  
--callbackr   cru  r  )r   variable_argsr-   r   r=   r  s     r   r   TestCallbackVarArgs.setUp  sR    t%qsCtLsCt\*(,(:(:FG /^;BDr!   c                 N   U R                  US L 5        / nUR                  nU(       a\  US   nUS S S:X  a  [        U5      S:  d!  US S S:X  a  [        U5      S:  a
  US   S:w  a  OUR                  U5        US	 U(       a  M\  [	        UR
                  UR                  U5        g )Nr   r   r   r   r:  )rP   rz  rj  r  rS  r2  r   )r   rO  rP  rQ  r=   rz  args          r   r  !TestCallbackVarArgs.variable_args  s    &(CRaDSX\RaCCHqLSVs]S!!H e 	v{{E2r!   c                 :    U R                  / SQSS SS/S./ 5        g )N)z-a3r  r  r   r   )r  r  r   r   r  r   r  r  r#   s    r   test_variable_args&TestCallbackVarArgs.test_variable_args  s$    D!(t5%.I	r!   c                 <    U R                  / SQS S/ SQS.S/5        g )N)r`  37r   xxxr   helloT)r  r   r  r  r  r  r#   s    r   %test_consume_separator_stop_at_option9TestCallbackVarArgs.test_consume_separator_stop_at_option  s(    C!%!%!46 $9		&r!   c                 <    U R                  / SQS S / SQS.S/5        g )N)r  r`  r   r:  r   )r   r:  r   r  r  r  r#   s    r   %test_positional_arg_and_variable_args9TestCallbackVarArgs.test_positional_arg_and_variable_args  s(    =!%!% 35 $9		&r!   c                 8    U R                  / SQS SS/S./ 5        g )N)r`  r   r   Tr   r  r  r#   s    r   test_stop_at_option'TestCallbackVarArgs.test_stop_at_option  s"    .!%Dw?	r!   c                 ,    U R                  / SQS5        g )N)r`  r  r  r"  zno such option: -5r  r#   s    r   test_stop_at_invalid_option/TestCallbackVarArgs.test_stop_at_invalid_option  s    46JKr!   r   N)r&   r'   r(   r)   r   r  r  r  r  r  r  r*   r+   r!   r   r  r    s'    D3
&&
Lr!   r  c                        \ rS rSrS rS rSrg)ConflictBasei	  c                 F    [        SSSSSS9/n[        [        US9U l        g )Nr   r   r   r   zincrement verbosityr   r   r  r  r  r  s     r   r   ConflictBase.setUp
  s1    t[$-4IK L.^;BDr!   c                 &    SUR                   l        g )Nr   )r2  show_versionr  s        r   r  ConflictBase.show_version  s    %&"r!   r   N)r&   r'   r(   r)   r   r  r*   r+   r!   r   r  r  	  s    D'r!   r  c                   0    \ rS rSrSrS rS rS rS rSr	g)	TestConflicti  z9Use the default conflict resolution for Optik 1.2: error.c                     U R                  USSU R                  SS.[        S5      nU R                  UR                  S5        U R                  UR
                  S5        g )N)r   r  r   show versionr   r   r  z5option -v/--version: conflicting option string(s): -vz conflicting option string(s): -vz-v/--version)rY   r  r   r@   r2   	option_id)r   rS   rW   s      r   assertTrueconflict_error%TestConflict.assertTrueconflict_error  s`    %:595F5F1?(A  CE 	"DE7r!   c                 N    U R                  U R                  R                  5        g r   )r  r=   r   r#   s    r   test_conflict_error TestConflict.test_conflict_error   s    %%dkk&<&<=r!   c                 f    [        U R                  S5      nU R                  UR                  5        g )NzGroup 1)r   r=   r  r   r  s     r   test_conflict_error_group&TestConflict.test_conflict_error_group#  s&    DKK3%%e&6&67r!   c                 ^    U R                  U R                  R                  SS [        S5        g )Nr  z'invalid conflict_resolution value 'foo')rY   r=   set_conflict_handlerr  r#   s    r   test_no_such_conflict_handler*TestConflict.test_no_such_conflict_handler'  s(    KK,,hA	Cr!   r+   N)
r&   r'   r(   r)   r  r  r  r  r  r*   r+   r!   r   r  r    s    C	8>8Cr!   r  c                   8    \ rS rSrS rS rS rS rS rS r	Sr
g	)
TestConflictResolvei-  c                     [         R                  U 5        U R                  R                  S5        U R                  R	                  SSSU R
                  SS9  g )Nresolver   r  r   r  r  )r  r   r=   r  r   r  r#   s    r   r   TestConflictResolve.setUp.  sK    4 ((3t[(,(9(9 	 	Pr!   c                    U R                   R                  S5      nU R                   R                  S5      nU R                   R                  S5      nU R                  XL 5        U R                  XL5        U R                  UR                  S/5        U R                  UR
                  S/5        U R                  UR                  S/5        U R                  UR
                  / 5        U R                  UR                  S/5        g )Nr   r   r  )r=   r   rP   r@   r  r   )r   ry  verbose_optversion_opts       r   test_conflict_resolve)TestConflictResolve.test_conflict_resolve4  s    &&t,kk,,[9kk,,[9,-01))K=9004&9//+?00"5//+?r!   c                 *    U R                  S/S5        g )Nr  z}Options:
  --verbose      increment verbosity
  -h, --help     show this help message and exit
  -v, --version  show version
rj   r#   s    r   test_conflict_resolve_help.TestConflictResolve.test_conflict_resolve_helpA  s    4& # 	r!   c                 2    U R                  S/S SS./ 5        g )Nr   r   r   r  r  r#   s    r   test_conflict_resolve_short_opt3TestConflictResolve.test_conflict_resolve_short_optI  s    D6'+Q?	r!   c                 0    U R                  S/SS0/ 5        g )Nr   r   r   r  r#   s    r   test_conflict_resolve_long_opt2TestConflictResolve.test_conflict_resolve_long_optN  s    K=%q>	r!   c                 4    U R                  SS/SSS./ 5        g )Nr   r  r   r  r  r#   s    r   test_conflict_resolve_long_opts3TestConflictResolve.test_conflict_resolve_long_optsS  s"    K5'(!<	r!   r+   N)r&   r'   r(   r)   r   r  r  r  r  r  r*   r+   r!   r   r  r  -  s"    P@

r!   r  c                   ,    \ rS rSrS rS rS rS rSrg)TestConflictOverrideiX  c           	          [        [        S9U l        U R                  R                  S5        U R                  R	                  SSSSSS9  U R                  R	                  SSS	S
SSS9  g )Nr|   r  r   	--dry-runr   dry_runzdon't do anythingr  rw  r!  zdry run mode)r   r   r   r  )r-   r   r=   r  r   r#   s    r   r   TestConflictOverride.setUpY  sj    .^D((3t[&2$7 	 	9 	{D&32I$2 	 	4r!   c                     U R                   R                  S5      nU R                  UR                  S/5        U R                  UR                  S/5        g )Nr  r   )r=   r   r@   r   r  rq  s     r   test_conflict_override_opts0TestConflictOverride.test_conflict_override_optsc  sB    kk$$[14&1+7r!   c                 *    U R                  S/S5        g )Nr  zXOptions:
  -h, --help     show this help message and exit
  -n, --dry-run  dry run mode
r  r#   s    r   test_conflict_override_help0TestConflictOverride.test_conflict_override_helph  s    4& # 	r!   c                 0    U R                  S/SS0/ 5        g )Nr   r  r!  r  r#   s    r   test_conflict_override_args0TestConflictOverride.test_conflict_override_argso  s    D6%r?	r!   r   N)	r&   r'   r(   r)   r   r  r  r  r*   r+   r!   r   r  r  X  s    48
r!   r  aS  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
aS  Usage: 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
aW  Usage
=====
  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
c                   V    \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rSrg)TestHelpi  c                 0    U R                  S5      U l        g )NP   )make_parserr=   r#   s    r   r   TestHelp.setUp  s    &&r*r!   c           
          [        SSSSSS9[        SSS	S
SSS9[        SSSSSS9/n[        R                  " 5        n[        U5      US'   [	        US9sS S S 5        $ ! , (       d  f       g = f)Nr"  r=  r  APPLEzthrow APPLEs at basket)re   r   metavarr  r   r  r   r  NUMzeshout "boo!" NUM times (in order to frighten away all the evil spirits that cause trouble and mayhem)r  r  r   z*store FOO in the foo list for later fooing)r   re   r   r  COLUMNSrM  )r   r   EnvironmentVarGuardrL   r-   )r   columnsrE   envs       r   r  TestHelp.make_parser  s    8# '.FHgE %NO
 xeIK
  **, \C	N+@ -,,s   A
A,c                 
   [         R                  S S  n [        R                  R	                  SS5      [         R                  S'   U R                  S/U5        U[         R                  S S & g ! U[         R                  S S & f = f)Nr   zbar.pyr   r  )rb   r  r  r  r  rj   )r   r^   r  s      r   assertHelpEqualsTestHelp.assertHelpEquals  s]    HHQK		$'',,uh7CHHQKtfo6#CHHQK)CHHQKs   AA- -Bc                 .    U R                  [        5        g r   )r  _expected_help_basicr#   s    r   	test_helpTestHelp.test_help  s    23r!   c                 d    U R                   R                  S5        U R                  [        5        g )NzUsage: %prog [options])r=   	set_usager  r  r#   s    r   test_help_old_usageTestHelp.test_help_old_usage  s$    6723r!   c                 d    SU R                   R                  l        U R                  [        5        g )Nr   )r=   r  short_firstr  _expected_help_long_opts_firstr#   s    r   test_help_long_opts_first"TestHelp.test_help_long_opts_first  s#    ,-)<=r!   c                     [         R                  " 5        nSUS'   [        5       U R                  l        U R                  [        5        S S S 5        g ! , (       d  f       g = f)N80r	  )r   r
  r
   r=   r  r  _expected_help_title_formatter)r   r  s     r   test_help_title_formatter"TestHelp.test_help_title_formatter  sC    **,!C	N$7$9DKK!!!"@A -,,s   4A
A!c                     U R                  S5      U l        U R                  [        5        U R                  S5      U l        U R                  [        5        g )NrD  r   )r  r=   r  _expected_help_short_lines_expected_very_help_short_linesr#   s    r   test_wrap_columnsTestHelp.test_wrap_columns  sF     &&r*89&&q)=>r!   c                     [        [        S9U l        U R                  R                  SSSS9  SnU R	                  U5        g )Nr|   r"  r      olé!r  uK   Options:
  -h, --help  show this help message and exit
  -a          olé!
)r-   r   r=   r   r  r   expects     r   test_help_unicodeTestHelp.test_help_unicode  s>    .^DtL{K
 	f%r!   c                 P    [        [        SS9U l        SnU R                  U5        g )Nr)  )r}   r  u>   olé!

Options:
  -h, --help  show this help message and exit
)r-   r   r=   r  r*  s     r   test_help_unicode_description&TestHelp.test_help_unicode_description  s+    .^;FH 	f%r!   c                 0   U R                   R                  S5        [        U R                   SS5      nUR                  SSSS9  U R                   R	                  U5        SnU R                  U5        S	U R                   l        U R                  US
-   5        g )Nz`This is the program description for %prog.  %prog has an option group as well as single options.zDangerous OptionszZCaution: use of these options is at your own risk.  It is believed that some of them bite.z-gr   zGroup option.r  aT  Usage: 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.
)r=   set_descriptionr   r   r  r  epilog)r   r  r+  s      r   test_help_description_groups%TestHelp.test_help_description_groups  s    ##9	: KK,56 	lI$$U+( 	f%?f'MMNr!   r   N)r&   r'   r(   r)   r   r  r  r  r  r  r!  r&  r,  r/  r4  r*   r+   r!   r   r   r     s<    +A*$44>B?&	&#Or!   r   c                        \ rS rSrS rS rSrg)TestMatchAbbrevi?  c           
      F    U R                  [        SS S S S S.5      S5        g )N--f)r"  r  --fier9  )r@   r   r#   s    r   test_match_abbrev!TestMatchAbbrev.test_match_abbrev@  s/    u151515/3(56
 	 r!   c                 P    SnS S S S.nU R                  [        X4S [        S5        g )Nr9  )r"  r  r:  z,ambiguous option: --f (--fie, --foo, --foz?))rY   r   r   )r   rE  wordmaps      r   test_match_abbrev_error'TestMatchAbbrev.test_match_abbrev_errorH  s1     4$?A<J	Lr!   r+   N)r&   r'   r(   r)   r;  r?  r*   r+   r!   r   r7  r7  ?  s     Lr!   r7  c                   ,    \ rS rSrS rS rS rS rSrg)TestParseNumberiP  c                     [        5       U l        U R                  R                  S[        S9  U R                  R                  S[        S9  g )Nr   r<  -l)r-   r=   r   r   r#   s    r   r   TestParseNumber.setUpQ  s:    .0t#.t#.r!   c           	          U R                  [        S[        40 [        [        R
                  " S5      5        U R                  [        S[        40 [        [        R
                  " S5      5        g )Nr   z!invalid literal for int().*: '?'?0xOoopsz*invalid literal for int().*: s?'?0xOoops'?)rY   r   r   r  rN   compiler#   s    r   test_parse_num_fail#TestParseNumber.test_parse_num_failV  sX    S	2JJ;<	> 	C("JJDE	Gr!   c                    U R                  [        S[        5      S5        U R                  [        S[        5      S5        U R                  [        S[        5      S5        U R                  [        S[        5      S5        U R                  [        S	[        5      S
5        U R                  [        S[        5      S5        g )Nr  r   0x10   0XA
   010   0b11r  0b)r@   r   r   r#   s    r   test_parse_num_ok!TestParseNumber.test_parse_num_ok`  s    C-q1FC0"5E3/4E3/3FC0!4D#.2r!   c                     U R                  / SQSSS./ 5        U R                  / SQSSS./ 5        U R                  S/S	5        U R                  S
/S5        U R                  SS/S5        g )N)r   ry  rD  0x20r!      )ra  l)r   0b0101z-l010r@  rQ  z-n008z'option -n: invalid integer value: '008'z-l0b0123z*option -l: invalid integer value: '0b0123'rD  0x12xz)option -l: invalid integer value: '0x12x')rH   r_   r#   s    r   test_numeric_options$TestParseNumber.test_numeric_optionsh  s|    5"$412	74"#!-r	3gYF	Hj\I	KdG_H	Jr!   r   N)	r&   r'   r(   r)   r   rI  rT  r\  r*   r+   r!   r   rB  rB  P  s    /
G3
Jr!   rB  c                       \ rS rSrS rSrg)MiscTestCaseiu  c                 @    1 Skn[         R                  " U [        US9  g )N>   
NO_DEFAULTcheck_builtinAmbiguousOptionError)not_exported)r   check__all__optparse)r   rd  s     r   test__all__MiscTestCase.test__all__v  s    NT8,Gr!   r+   N)r&   r'   r(   r)   rg  r*   r+   r!   r   r_  r_  u  s    Hr!   r_  c                       \ rS rSrS rSrg)TestTranslationsi{  c                 .    U R                  [        5        g r   )assertMsgidsEqualrf  r#   s    r   test_translations"TestTranslations.test_translations|  s    x(r!   r+   N)r&   r'   r(   r)   rm  r*   r+   r!   r   rj  rj  {  s    )r!   rj  __main__z--snapshot-update)Orb   r  rN   rW  unittestior   r  r   test.supportr   test.support.i18n_helperr   r   rf  r   r	   r
   r   r   r   r   r   r   r   r   r   r   	Exceptionr   r-   TestCaser:   rx   r   r+  r7  rL  rR  rT  rZ  r  r  r  rJ  r^  ru  r  r  r  r  r  r  r3  rL  ra  rr  r  r  r  r  r  r  r  r  r  r   r$  r%  r   r7  rB  r_  rj  r&   rj  r  r3   mainr+   r!   r   <module>rw     s    	 	     " W . . . . # 
Ny 
N2| 2M%x   M%jJ#x J#XL?x L?^(x (*Ch C  rh@>/V /
0J 0Jf'78 '7TI4 I4\H38 H3T!x !F. ..8/ 8/tDx D2X ::( :$6h 6 Hh HD(/ (/V8 >3/8 3/lH 2 X  :8 2
.h 
.0L( 0Lj'8 'C< C4), )V8 <	 	" "  # BtOx tOnLh L""Jh "JJH8$$ H)+ )
 z
388}qSXXa[,??$X.MMO r!   