
    h[                        S r SSKJr  SSKJr   " S S\R
                  5      r " S S\R                  5      r " S S	\R
                  5      r	 " S
 S\R                  5      r
 " S S\R
                  5      r " S S\R
                  5      r " S S\R                  5      r " S S\R                  5      r " S S\R
                  5      r " S S\R
                  5      r " S S\R
                  5      r " S S\R                  5      r " S S\R                  5      r " S S\R                  5      r " S  S!\R                  5      r " S" S#\R                  5      r " S$ S%\R                  5      r " S& S'\R                  5      rg())zK
Tests for L{twisted.python.usage}, a command line option parsing library.
    usage)unittestc                   L    \ rS rSr/ SQ/ SQ/ SQ/ SQ/r/ SQSS//rS	 rS
 rSrg)WellBehaved   )longwdefaultzand a docstring)anothernzno docstring)longonlyNnoshort)	shortlessNexceptzthis one got docstring)aflagfzO

                 flagallicious docstringness for this here

                 floutoc                 "    SU R                   S'   g )NPONY!myflagoptsselfs    ^/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/test/test_usage.py
opt_myflagWellBehaved.opt_myflag!   s    %		(    c                 (    U S3U R                   S'   g )Nz WITH A PONY!myparamr   r   values     r   opt_myparamWellBehaved.opt_myparam$   s    "'6		)r     N)	__name__
__module____qualname____firstlineno__optParametersoptFlagsr   r%   __static_attributes__r'   r    r   r   r      s4    3(%?	M	
 
#H&7r    r   c                   0    \ rS rSrSrS rS rS rS rSr	g)	ParseCorrectnessTests(   zN
Test L{usage.Options.parseOptions} for correct values under
good conditions.
c                     SR                  5       U l        [        5       U l        U R                  R	                  U R                  5        g)z<
Instantiate and parseOptions a well-behaved Options class.
A--long Alpha -n Beta --shortless Gamma -f --myflag --myparam TofuN)splitniceArgVr   niceparseOptionsr   s    r   setUpParseCorrectnessTests.setUp.   s7     V
%' 	  M			t}}-r    c                 L   U R                  U R                  R                  S   S5        U R                  U R                  R                  S   S5        U R                  U R                  R                  S   S5        U R                  U R                  R                  S   S5        g	)
z!
Parameters have correct values.
r	   Alphar   Betar   r   r   GammaNassertEqualr6   r   r   s    r   test_checkParameters*ParseCorrectnessTests.test_checkParameters;   sx     	/9	2F;
3Y?4g>r    c                     U R                  U R                  R                  S   S5        U R                  U R                  R                  S   S5        g)z
Flags have correct values.
r      r   r   Nr>   r   s    r   test_checkFlags%ParseCorrectnessTests.test_checkFlagsD   s>     	0!40!4r    c                     U R                  U R                  R                  S   S5        U R                  U R                  R                  S   S5        g)z2
Custom flags and parameters have correct values.
r   r   r"   zTofu WITH A PONY!Nr>   r   s    r   test_checkCustoms'ParseCorrectnessTests.test_checkCustomsK   s?     	17;	24GHr    r6   r5   N)
r(   r)   r*   r+   __doc__r8   r@   rD   rG   r.   r'   r    r   r0   r0   (   s    
.?5Ir    r0   c                   R    \ rS rSrSSSS\/SSSS\/S	SSS
\/SSSS\//rS r\rSr	g)TypedOptionsS   foointN  zFoo intfoofloatQ@z	Foo floateggintzEgg int without defaulteggfloatzEgg float without defaultc                     Xl         g)zO
This option has an underscore in its name to exercise the _ to -
translation.
NunderscoreValuer#   s     r   opt_under_scoreTypedOptions.opt_under_score[   s
    
  %r    rU   )
r(   r)   r*   r+   intfloatr,   rW   opt_ur.   r'   r    r   rL   rL   S   sO    	4i-	T4e4	48#>	T4!<eD	M% Er    rL   c                   <    \ rS rSrSrS rS rS rS rS r	S r
S	rg
)
TypedTestse   zC
Test L{usage.Options.parseOptions} for options with forced types.
c                 "    [        5       U l        g N)rL   r   r   s    r   r8   TypedTests.setUpj   s    !^
r    c                 6   / nU R                   R                  U5        U R                  U R                   R                  S   S5        U R	                  U R                   R                  S   [
        5        U R                  U R                   R                  S   S5        U R	                  U R                   R                  S   [        5        U R                  U R                   R                  S   5        U R                  U R                   R                  S   5        g)z
Default values are parsed.
rN   rO   rP   rQ   rR   rS   N)r   r7   r?   r   assertIsInstancerY   rZ   assertIsNoner   argVs     r   test_defaultValuesTypedTests.test_defaultValuesm   s     

%2C8djjooh7=4d;djjooj95A$**//(34$**//*56r    c                 
   SR                  5       nU R                  R                  U5        U R                  U R                  R                  S   S5        U R                  U R                  R                  S   [        5        U R                  U R                  R                  S   S5        U R                  U R                  R                  S   [        5        U R                  U R                  R                  S   S5        U R                  U R                  R                  S   [        5        U R                  U R                  R                  S   S	5        U R                  U R                  R                  S   [        5        g
)z"
int and float values are parsed.
z8--fooint 912 --foofloat -823.1 --eggint 32 --eggfloat 21rN   i  rP   g̸rR       rS   g      5@N)r4   r   r7   r?   r   rc   rY   rZ   re   s     r   test_parsingValuesTypedTests.test_parsingValuesz   s    NTTV

%2C8djjooh7=4f=djjooj95A2B7djjooh7=4d;djjooj95Ar    c                     U R                   R                  SS/5        U R                  U R                   R                  S5        g)z_
A dash in an option name is translated to an underscore before being
dispatched to a handler.
z--under-scorefooNr   r7   r?   rV   r   s    r   test_underscoreOption TypedTests.test_underscoreOption   s5    
 	

% 8933U;r    c                     U R                   R                  SS/5        U R                  U R                   R                  S5        g)z5
An option name with a dash in it can have an alias.
z-ubarNro   r   s    r   test_underscoreOptionAlias%TypedTests.test_underscoreOptionAlias   s4     	

u.33U;r    c                     SR                  5       nU R                  [        R                  U R                  R                  U5        g)z'
Passing wrong values raises an error.
z--fooint eggN)r4   assertRaisesr   
UsageErrorr7   re   s     r   test_invalidValuesTypedTests.test_invalidValues   s4     ##%%**DJJ,C,CTJr    r   N)r(   r)   r*   r+   rJ   r8   rg   rk   rp   rt   ry   r.   r'   r    r   r]   r]   e   s'    $7B<<Kr    r]   c                       \ rS rSr/ SQ/rSrg)WrongTypedOptions   )barwrongNNzBar with wrong coerceher'   N)r(   r)   r*   r+   r,   r.   r'   r    r   r|   r|      s
    LMMr    r|   c                   <    \ rS rSrS rS rSSSS\/SSSS\//rS	rg)
WeirdCallableOptions   c                     [        S5      e)NOuch)RuntimeErrorr$   s    r   _barWeirdCallableOptions._bar   s    6""r    c                     [        S5      e)NYay)
ValueErrorr   s    r   _fooWeirdCallableOptions._foo   s    r    r~   NzBar with strange callablefoowrongzFoo with strange callabler'   )r(   r)   r*   r+   r   r   r,   r.   r'   r    r   r   r      s3    #  
T4!<dC	T4!<dCMr    r   c                   *    \ rS rSrSrS rS rS rSrg)WrongTypedTests   z>
Test L{usage.Options.parseOptions} for wrong coerce options.
c                 z    [        5       nSR                  5       nU R                  [        UR                  U5        g)z"
Using a non-callable type fails.
z--barwrong eggN)r|   r4   rw   	TypeErrorr7   r   usrf   s      r   test_nonCallable WrongTypedTests.test_nonCallable   s0      %%')R__d;r    c                 >    [        5       n/ nUR                  U5        g)z@
The coerce functions are not called if no values are provided.
N)r   r7   r   s      r   test_notCalledInDefault'WrongTypedTests.test_notCalledInDefault   s     "#
r    c                 :   [        5       nSR                  5       nU R                  [        R                  UR
                  U5      nU R                  [        U5      S5        [        5       nSR                  5       nU R                  [        UR
                  U5        g)z9
Errors raised by coerce functions are handled properly.
z--foowrong blahz&Parameter type enforcement failed: Yayz--barwrong blahN)	r   r4   rw   r   rx   r7   r?   strr   )r   r   rf   es       r   test_weirdCallable"WrongTypedTests.test_weirdCallable   sy     "# &&(e..FQ!IJ!# &&(,>r    r'   N)	r(   r)   r*   r+   rJ   r   r   r   r.   r'   r    r   r   r      s    <?r    r   c                       \ rS rSrS rSrg)OutputTests   c                     [        5       nU R                  [        R                  UR                  S/5      nU R                  [        U5      S5        g)z6
Error output case adjustment does not mangle options
z-Zzoption -Z not recognizedN)r   rw   r   rx   r7   r?   r   )r   optr   s      r   test_uppercasingOutputTests.test_uppercasing   sB     me..0@0@4&IQ!;<r    r'   N)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g)InquisitionOptions   )expectr   )torture-devicetcomfy-chairzset preferred torture devicer'   N)r(   r)   r*   r+   r-   r,   r.   r'   r    r   r   r      s    H 	OMr    r   c                       \ rS rSrSS/rSrg)HolyQuestOptions   )	horsebackhzuse a horse)	for-grailgr'   N)r(   r)   r*   r+   r-   r.   r'   r    r   r   r      s    )Hr    r   c                   2    \ rS rSrS/rSS\S4SS\S4/rS	rg
)SubCommandOptions   )europian-swallowNz$set default swallow type to EuropianinquisitioninquestzPerform an inquisition	holyquestquestzEmbark upon a holy questr'   N)	r(   r)   r*   r+   r-   r   r   subCommandsr.   r'   r    r   r   r      s1    JH 
	#57OP	g/1KLKr    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g)SubCommandTests   zB
Test L{usage.Options.parseOptions} for options with subcommands.
c                 X   [        5       nUR                  SS/5        U R                  US   5        U R                  UR                  S5        U R                  UR                  [        5        U R                  UR                  S   5        U R                  UR                  S   S5        g)z
A subcommand is recognized.
--europian-swallowr   r   r   r   r   N)	r   r7   
assertTruer?   
subCommandrc   
subOptionsr   assertFalser   r   s     r   test_simpleSubcommand%SubCommandTests.test_simpleSubcommand   s     	,m<=,-.}5all,>?h/0&67Gr    c                 X   [        5       nUR                  / SQ5        U R                  US   5        U R                  UR                  S5        U R                  UR                  [        5        U R                  UR                  S   5        U R                  UR                  S   S5        g)z1
Flags and options of a subcommand are assigned.
)r   --expect--torture-device=featherr   r   r   r   featherN	r   r7   r   r?   r   rc   r   r   r   r   s     r   "test_subcommandWithFlagsAndOptions2SubCommandTests.test_subcommandWithFlagsAndOptions  s     	NO-./}5all,>?X./&67Cr    c                 X   [        5       nUR                  / SQ5        U R                  US   5        U R                  UR                  S5        U R                  UR                  [        5        U R                  UR                  S   5        U R                  UR                  S   S5        g)z7
Flags and options of a subcommand alias are assigned.
)r   r   r   r   r   r   r   r   Nr   r   s     r   'test_subcommandAliasWithFlagsAndOptions7SubCommandTests.test_subcommandAliasWithFlagsAndOptions  s     	JK-./}5all,>?X./&67Cr    c                 V   [        5       nUR                  SS/5        U R                  US   5        U R                  UR                  S5        U R                  UR                  [        5        U R                  UR                  S   5        U R                  UR                  S   5        g)z7
Flags and options of another subcommand are assigned.
r   z--for-grailr   r   r   N)	r   r7   r   r?   r   rc   r   r   r   r   s     r   )test_anotherSubcommandWithFlagsAndOptions9SubCommandTests.test_anotherSubcommandWithFlagsAndOptions#  s     	]34-./{3all,<=k23[12r    c                     [        5       nUR                  S/5        U R                  US   5        U R                  UR                  5        U R                  [        US5      5        g)zh
If no subcommand is specified and no default subcommand is assigned,
a subcommand will not be implied.
r   r   r   N)r   r7   r   rd   r   r   hasattrr   s     r   test_noSubcommand!SubCommandTests.test_noSubcommand/  sU    
 	,-.,-.!,,'L12r    c                 d   [        5       nSUl        UR                  S/5        U R                  US   5        U R	                  UR
                  S5        U R                  UR                  [        5        U R                  UR                  S   5        U R	                  UR                  S   S5        g)	z;
Flags and options in the default subcommand are assigned.
r   r   r   r   r   r   r   N)
r   defaultSubCommandr7   r   r?   r   rc   r   r   r   r   s     r   test_defaultSubcommand&SubCommandTests.test_defaultSubcommand:  s     '	,-.,-.}5all,>?h/0&67Gr    c                 8  ^  " S S[         R                  5      m " U4S jS[         R                  5      nU" 5       nUR                  S/5        U R                  [	        UR
                  S5      5        U R                  UR
                  R                  U5        g)z_
The parseOptions method from the Options object specified for the
given subcommand is called.
c                       \ rS rSrS rSrg)DSubCommandTests.test_subCommandParseOptionsHasParent.<locals>.SubOptiM  c                 n    U R                   U l        [        R                  R                  " U /UQ70 UD6  g r`   )parent	sawParentr   Optionsr7   )r   akws      r   r7   QSubCommandTests.test_subCommandParseOptionsHasParent.<locals>.SubOpt.parseOptionsN  s)    !%**4:!:r:r    )r   N)r(   r)   r*   r+   r7   r.   r'   r    r   SubOptr   M  s    ;r    r   c                   &   > \ rS rSrSS Y S4/rSrg)ASubCommandTests.test_subCommandParseOptionsHasParent.<locals>.OptiR  rn   r   rs   r'   Nr(   r)   r*   r+   r   r.   r   s   r   Optr   R  s    VU+Kr    r   rn   r   N)r   r   r7   r   r   r   r?   r   )r   r   r   r   s      @r   $test_subCommandParseOptionsHasParent4SubCommandTests.test_subCommandParseOptionsHasParentG  sk    	;U]] 	;
	%-- 	
 E	wk:;//3r    c                 8  ^  " S S[         R                  5      m " U4S jS[         R                  5      n " U4S jS[         R                  5      nU" 5       nUR                  S/5        U" 5       nUR                  S/5        U R                  [	        UR
                  S	5      5        U R                  [	        UR
                  S	5      5        U R                  UR
                  R                  U5        U R                  UR
                  R                  U5        g
)zP
The .parent pointer is correct even when the same Options class is
used twice.
c                       \ rS rSrSrg):SubCommandTests.test_subCommandInTwoPlaces.<locals>.SubOptib  r'   N)r(   r)   r*   r+   r.   r'   r    r   r   r   b  s    r    r   c                   &   > \ rS rSrSS Y S4/rSrg):SubCommandTests.test_subCommandInTwoPlaces.<locals>.OptFooie  rn   r   quuxr'   Nr   r   s   r   OptFoor   e      VV,Kr    r   c                   &   > \ rS rSrSS Y S4/rSrg):SubCommandTests.test_subCommandInTwoPlaces.<locals>.OptBarij  rs   br   r'   Nr   r   s   r   OptBarr   j  r   r    r   rn   rs   r   N)r   r   r7   r   r   r   failUnlessIdenticalr   )r   r   r   oFoooBarr   s        @r   test_subCommandInTwoPlaces*SubCommandTests.test_subCommandInTwoPlaces\  s    	U]] 		U]] 	
	U]] 	
 x5'"x5'":;:;  !7!7>  !7!7>r    r'   N)r(   r)   r*   r+   rJ   r   r   r   r   r   r   r   r   r.   r'   r    r   r   r      s3    
H
D
D
3	3H4*?r    r   c                   *    \ rS rSrSrS rS rS rSrg)HelpStringTestsiy  z
Test generated help strings.
c                 L    SR                  5       U l        [        5       U l        g)z+
Instantiate a well-behaved Options class.
r3   N)r4   r5   r   r6   r   s    r   r8   HelpStringTests.setUp~  s!     V
%' 	  M	r    c                      U R                   R                  5         g! [         a  nU R                  U5         SnAgSnAff = f)z
__str__ shouldn't go boom.
N)r6   __str__	Exceptionfail)r   r   s     r   test_noGoBoomHelpStringTests.test_noGoBoom  s4    	II 	IIaLL	s    
A=Ac                 &   [        U R                  5      R                  5        Vs/ s H  oR                  S5      S:  d  M  UPM     nnU R	                  [        U5      S:  5        U R	                  US   R                  S5      S:  5        gs  snf )z;
Extra whitespace in flag and parameters docs is stripped.
r   r   flagalliciousN)r   r6   
splitlinesfindr   len)r   sliness      r   &test_whitespaceStripFlagsAndParameters6HelpStringTests.test_whitespaceStripFlagsAndParameters  sp      		N557P7q66'?a;O7PE
Q'ao6!;< Qs   BBrI   N)	r(   r)   r*   r+   rJ   r8   r
  r  r.   r'   r    r   r  r  y  s    	"=r    r  c                   $    \ rS rSrSrS rS rSrg)PortCoerceTestsi  z+
Test the behavior of L{usage.portCoerce}.
c                     U R                  S[        R                  " S5      5        U R                  S[        R                  " S5      5        U R                  S[        R                  " S5      5        g)z$
Test the answers with valid input.
r   0i  3210i  65535N)r?   r   
portCoercer   s    r   test_validCoerce PortCoerceTests.test_validCoerce  sU     	E,,S12u//78 0 0 9:r    c                 ,   U R                  [        [        R                  S5        U R                  [        [        R                  S5        U R                  [        [        R                  S5        U R                  [        [        R                  S5        g)z
Test error path.
 z-21212189rn   N)rw   r   r   r  r   s    r   test_errorCoerce PortCoerceTests.test_errorCoerce  sd     	*e&6&6;*e&6&6>*e&6&6A*e&6&6>r    r'   N)r(   r)   r*   r+   rJ   r  r!  r.   r'   r    r   r  r    s    ;?r    r  c                   T    \ 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)ZshCompleterTestsi  z
Test the behavior of the various L{twisted.usage.Completer} classes
for producing output usable by zsh tab-completion system.
c                     [         R                  " 5       nUR                  S[         R                  5      nU R	                  US5        [         R                  " SSS9nUR                  S[         R                  5      nU R	                  US5        g)zH
Completer produces zsh shell-code that produces no completion matches.
some-optionz:some-option:some actionTdescrrepeat*:some action:N)r   	Completer
_shellCode_ZSHr?   r   cgots      r   test_completer ZshCompleterTests.test_completer  si     OOll=%**5o.OO-=ll=%**5./r    c                    [         R                  " 5       nUR                  S[         R                  5      nU R	                  US5        [         R                  " S5      nUR                  S[         R                  5      nU R	                  US5        [         R                  " SSSS9nUR                  S[         R                  5      nU R	                  US5        g	)
zV
CompleteFiles produces zsh shell-code that completes file names
according to a glob.
r&  z:some-option (*):_files -g "*"z*.pyz$:some-option (*.py):_files -g "*.py"r'  Tr(  z%*:some action (*.py):_files -g "*.py"N)r   CompleteFilesr-  r.  r?   r/  s      r   
test_filesZshCompleterTests.test_files  s    
 !ll=%**5>?'ll=%**5DEmDIll=%**5EFr    c                     [         R                  " 5       nUR                  S[         R                  5      nU R	                  US5        [         R                  " SSS9nUR                  S[         R                  5      nU R	                  US5        g)zF
CompleteDirs produces zsh shell-code that completes directory names.
r&  z:some-option:_directoriesr'  Tr(  z*:some action:_directoriesN)r   CompleteDirsr-  r.  r?   r/  s      r   	test_dirsZshCompleterTests.test_dirs  sn      ll=%**59:]4@ll=%**5:;r    c                    [         R                  " S5      nUR                  S[         R                  5      nU R	                  US5        [         R                  " / SQ5      nUR                  S[         R                  5      nU R	                  US5        [         R                  " / SQSSS9nUR                  S[         R                  5      nU R	                  US	5        g
)z_
CompleteList produces zsh shell-code that completes words from a fixed
list of possibilities.
ABCr&  z:some-option:(A B C)123z:some-option:(1 2 3)r'  Tr(  z*:some action:(1 2 3)N)r   CompleteListr-  r.  r?   r/  s      r   	test_listZshCompleterTests.test_list  s    
 u%ll=%**545/ll=%**545mDQll=%**556r    c                    [         R                  " S5      nUR                  S[         R                  5      nU R	                  US5        [         R                  " / SQ5      nUR                  S[         R                  5      nU R	                  US5        [         R                  " / SQSSS9nUR                  S[         R                  5      nS	nU R	                  X#5        g
)z}
CompleteMultiList produces zsh shell-code that completes multiple
comma-separated words from a fixed list of possibilities.
r=  r&  z-:some-option:_values -s , 'some-option' A B Cr>  z-:some-option:_values -s , 'some-option' 1 2 3r'  Tr(  z.*:some action:_values -s , 'some action' 1 2 3N)r   CompleteMultiListr-  r.  r?   )r   r0  r1  expecteds       r   test_multiList ZshCompleterTests.test_multiList  s    
 ##E*ll=%**5MN##O4ll=%**5MN##O=QUVll=%**5C'r    c                     [         R                  " 5       nUR                  S[         R                  5      nU R	                  US5        [         R                  " SSS9nUR                  S[         R                  5      nU R	                  US5        g)zL
CompleteUsernames produces zsh shell-code that completes system
usernames.
r&  z:some-option:_usersr'  Tr(  z*:some action:_usersN)r   CompleteUsernamesr-  r.  r?   r   r0  outs      r   test_usernames ZshCompleterTests.test_usernames  sn    
 ##%ll=%**534##-Ell=%**545r    c                     [         R                  " 5       nUR                  S[         R                  5      nU R	                  US5        [         R                  " SSS9nUR                  S[         R                  5      nU R	                  US5        g)zK
CompleteGroups produces zsh shell-code that completes system group
names.
r&  z:group:_groupsr'  Tr(  z*:some action:_groupsN)r   CompleteGroupsr-  r.  r?   rL  s      r   test_groupsZshCompleterTests.test_groups  sn    
   "ll=%**5./  }TBll=%**556r    c                     [         R                  " 5       nUR                  S[         R                  5      nU R	                  US5        [         R                  " SSS9nUR                  S[         R                  5      nU R	                  US5        g)zE
CompleteHostnames produces zsh shell-code that completes hostnames.
r&  z:some-option:_hostsr'  Tr(  z*:some action:_hostsN)r   CompleteHostnamesr-  r.  r?   rL  s      r   test_hostnames ZshCompleterTests.test_hostnames   sn     ##%ll=%**534##-Ell=%**545r    c                 X   [         R                  " 5       nUR                  S[         R                  5      nU R	                  UR                  S5      5        [         R                  " SSS9nUR                  S[         R                  5      nU R	                  UR                  S5      5        g)zr
CompleteUserAtHost produces zsh shell-code that completes hostnames or
a word of the form <username>@<hostname>.
r&  z:host | user@host:r'  Tr(  r+  N)r   CompleteUserAtHostr-  r.  r   
startswithrL  s      r   test_userAtHost!ZshCompleterTests.test_userAtHost,  sx    
 $$&ll=%**5';<=$$=Fll=%**5'789r    c                     [         R                  " 5       nUR                  S[         R                  5      nU R	                  US5        [         R                  " SSS9nUR                  S[         R                  5      nU R	                  US5        g)z^
CompleteNetInterfaces produces zsh shell-code that completes system
network interface names.
r&  z:some-option:_net_interfacesr'  Tr(  z*:some action:_net_interfacesN)r   CompleteNetInterfacesr-  r.  r?   rL  s      r   test_netInterfaces$ZshCompleterTests.test_netInterfaces9  sn    
 '')ll=%**5<=''mDIll=%**5=>r    r'   N)r(   r)   r*   r+   rJ   r2  r6  r:  rC  rH  rN  rR  rV  r[  r_  r.   r'   r    r   r$  r$    s:    

0G"
<7"($67
6:?r    r$  c                       \ rS rSrSrS rSrg)CompleterNotImplementedTestsiG  zg
Using an unknown shell constant with the various Completer() classes
should raise NotImplementedError
c           
         [         R                  [         R                  [         R                  [         R                  [         R
                  [         R                  [         R                  [         R                  [         R                  [         R                  /
nU H-  n U" 5       nU R                  [        UR                  SS5        M/     g! [         a    U" S5      n N;f = f)z=
Using an unknown shellType should raise NotImplementedError
Nbad_shell_type)r   r,  r5  r9  rB  rF  rK  rQ  rU  rY  r^  BaseExceptionrw   NotImplementedErrorr-  )r   classesclsactions       r   test_unknownShell.CompleterNotImplementedTests.test_unknownShellM  s    
 OO####  ##$$''
 C# #V%6%6>N  ! #T#s   CC"!C"r'   N)r(   r)   r*   r+   rJ   rj  r.   r'   r    r   rb  rb  G  s    
r    rb  c                   D    \ rS rSrSr " S S5      rS rS rS rS r	S	r
g
)FlagFunctionTestsih  z"
Tests for L{usage.flagFunction}.
c                   *    \ rS rSrSrS rS rS rSrg)FlagFunctionTests.SomeClassim  z.
Dummy class for L{usage.flagFunction} tests.
c                     g)z
A one argument method to be tested by L{usage.flagFunction}.

@param a: a useless argument to satisfy the function's signature.
Nr'   )r   r   s     r   oneArg"FlagFunctionTests.SomeClass.oneArgr      r    c                     g)z=
A no argument method to be tested by L{usage.flagFunction}.
Nr'   r   s    r   noArg!FlagFunctionTests.SomeClass.noArgy  rs  r    c                     g)a  
A multiple arguments method to be tested by L{usage.flagFunction}.

@param a: a useless argument to satisfy the function's signature.
@param b: a useless argument to satisfy the function's signature.
@param c: a useless argument to satisfy the function's signature.
Nr'   )r   r   r   r0  s       r   manyArgs$FlagFunctionTests.SomeClass.manyArgs~  rs  r    r'   N)	r(   r)   r*   r+   rJ   rq  ru  rx  r.   r'   r    r   	SomeClassro  m  s    			
	r    rz  c                     U R                  S[        R                  " U R                  5       R                  5      5        g)z[
L{usage.flagFunction} returns C{False} if the method checked allows
exactly one argument.
FN)assertIsr   flagFunctionrz  rq  r   s    r   test_hasArgFlagFunctionTests.test_hasArg  s*    
 	eU//0@0G0GHIr    c                     U R                  S[        R                  " U R                  5       R                  5      5        g)zY
L{usage.flagFunction} returns C{True} if the method checked allows
exactly no argument.
TN)r|  r   r}  rz  ru  r   s    r   
test_noArgFlagFunctionTests.test_noArg  s*    
 	dE..t~~/?/E/EFGr    c                     U R                  [        R                  [        R                  U R	                  5       R
                  5      nU R                  S[        U5      5        g)zg
L{usage.flagFunction} raises L{usage.UsageError} if the method checked
allows more than one argument.
z$Invalid Option function for manyArgsNrw   r   rx   r}  rz  rx  r?   r   r   excs     r   test_tooManyArguments'FlagFunctionTests.test_tooManyArguments  sK    
 e00$..2B2K2K
 	?SJr    c                     U R                  [        R                  [        R                  U R	                  5       R
                  S5      nU R                  S[        U5      5        g)zy
L{usage.flagFunction} uses the given method name in the error message
raised when the method allows too many arguments.
flubudufz$Invalid Option function for flubudufNr  r  s     r   ,test_tooManyArgumentsAndSpecificErrorMessage>FlagFunctionTests.test_tooManyArgumentsAndSpecificErrorMessage  sM    
 e00$..2B2K2KZ
 	?SJr    r'   N)r(   r)   r*   r+   rJ   rz  r~  r  r  r  r.   r'   r    r   rm  rm  h  s)     4JHKKr    rm  c                       \ rS rSrSrS rSrg)OptionsInternalTestsi  z.
Tests internal behavior of C{usage.Options}.
c                      " S S[         R                  5      nU" 5       nU R                  [        R	                  / SQS5      UR
                  S   UR
                  S   UR
                  S   S.5        g)z[
Options which are synonyms to another option are aliases towards the
longest option name.
c                   "    \ rS rSrS r\r\rSrg);OptionsInternalTests.test_optionsAliasesOrder.<locals>.Optsi  c                     g)zN
This is an option method with a very long name, that is going to
be aliased.
Nr'   r   s    r   opt_very_very_longNOptionsInternalTests.test_optionsAliasesOrder.<locals>.Opts.opt_very_very_long  rs  r    r'   N)r(   r)   r*   r+   r  	opt_shortopt_sr.   r'   r    r   Optsr    s     +I&Er    r  )r  shortvery-very-longr  r  r  N)r   r   r?   dictfromkeyssynonyms)r   r  r   s      r   test_optionsAliasesOrder-OptionsInternalTests.test_optionsAliasesOrder  sc    	'5== 	' vMM:<LM]]3'w/"&--0@"A	
r    r'   N)r(   r)   r*   r+   rJ   r  r.   r'   r    r   r  r    s    
r    r  N)rJ   twisted.pythonr   twisted.trialr   r   r   TestCaser0   rL   r]   r|   r   r   r   r   r   r   r   r  r  r$  rb  rm  r  r'   r    r   <module>r     s\  
 ! "7%-- 76(IH-- (IV5== $8K"" 8KvN N
5== 
"?h'' "?J=(## = u}}  |?h'' |?~!=h'' !=H?h'' ?.P?)) P?f8#4#4 B?K)) ?KD
8,, 
r    