%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/test/__pycache__/test_usage.cpython-312.pyc

�

Ϫ�f[���dZddlmZddlmZGd�dej
�ZGd�dej�ZGd�d	ej
�Z	Gd
�dej�Z
Gd�d
ej
�ZGd�dej
�ZGd�dej�Z
Gd�dej�ZGd�dej
�ZGd�dej
�ZGd�dej
�ZGd�dej�ZGd�dej�ZGd�dej�ZGd �d!ej�ZGd"�d#ej�ZGd$�d%ej�ZGd&�d'ej�Zy())zK
Tests for L{twisted.python.usage}, a command line option parsing library.
�)�usage)�unittestc�D�eZdZgd�gd�gd�gd�gZgd�ddggZd�Zd	�Zy
)�WellBehaved)�long�w�defaultzand a docstring)�another�nzno docstring)�longonlyN�noshort)�	shortlessN�exceptzthis one got docstring)�aflag�fzO

                 flagallicious docstringness for this here

                 �flout�oc�"�d|jd<y)N�PONY!�myflag��opts��selfs �9/usr/lib/python3/dist-packages/twisted/test/test_usage.py�
opt_myflagzWellBehaved.opt_myflag!s��%��	�	�(��c�(�|�d�|jd<y)Nz
 WITH A PONY!�myparamr�r�values  r�opt_myparamzWellBehaved.opt_myparam$s��"'��
�6��	�	�)�rN)�__name__�
__module__�__qualname__�
optParameters�optFlagsrr"�rrrr
s4��3�(�%�?�	�M�	
�
�#���H�&�7rrc�(�eZdZdZd�Zd�Zd�Zd�Zy)�ParseCorrectnessTestszZ
    Test L{usage.Options.parseOptions} for correct values under
    good conditions.
    c��dj�|_t�|_|jj	|j�y)zL
        Instantiate and parseOptions a well-behaved Options class.
        �A--long Alpha -n Beta --shortless Gamma -f --myflag --myparam TofuN)�split�niceArgVr�nice�parseOptionsrs r�setUpzParseCorrectnessTests.setUp.s7��
V�
�%�'�	
�
� �M��	��	�	���t�}�}�-rc�L�|j|jjdd�|j|jjdd�|j|jjdd�|j|jjdd�y	)
z1
        Parameters have correct values.
        r�Alphar
�Betarr
r�GammaN��assertEqualr/rrs r�test_checkParametersz*ParseCorrectnessTests.test_checkParameters;sx��	
���������/��9���������	�2�F�;���������
�3�Y�?����������4�g�>rc��|j|jjdd�|j|jjdd�y)z,
        Flags have correct values.
        r�rrNr6rs r�test_checkFlagsz%ParseCorrectnessTests.test_checkFlagsDs>��	
���������0�!�4����������0�!�4rc��|j|jjdd�|j|jjdd�y)zB
        Custom flags and parameters have correct values.
        rrrzTofu WITH A PONY!Nr6rs r�test_checkCustomsz'ParseCorrectnessTests.test_checkCustomsKs?��	
���������1�7�;���������	�2�4G�HrN)r#r$r%�__doc__r1r8r;r=r(rrr*r*(s���
.�?�5�Irr*c�J�eZdZddddegddddegdddd	egd
dddeggZd�ZeZy)
�TypedOptions�foointN�zFoo int�foofloat��Q���@z	Foo float�eggintzEgg int without default�eggfloatzEgg float without defaultc��||_y)zg
        This option has an underscore in its name to exercise the _ to -
        translation.
        N)�underscoreValuer s  r�opt_under_scorezTypedOptions.opt_under_score[s��
 %��r)r#r$r%�int�floatr&rI�opt_ur(rrr@r@SsO��	�4��i��-�	�T�4��e�4�	�4��8�#�>�	�T�4�!<�e�D�	�M�%�
�Err@c�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�
TypedTestszK
    Test L{usage.Options.parseOptions} for options with forced types.
    c�"�t�|_y�N)r@rrs rr1zTypedTests.setUpjs��!�^��
rc�6�g}|jj|�|j|jjdd�|j	|jjdt
�|j|jjdd�|j	|jjdt�|j|jjd�|j|jjd�y)z,
        Default values are parsed.
        rArBrCrDrErFN)rr0r7r�assertIsInstancerJrK�assertIsNone�r�argVs  r�test_defaultValueszTypedTests.test_defaultValuesms������
�
����%����������2�C�8����d�j�j�o�o�h�7��=����������4�d�;����d�j�j�o�o�j�9�5�A����$�*�*�/�/�(�3�4����$�*�*�/�/�*�5�6rc�
�dj�}|jj|�|j|jjdd�|j|jjdt�|j|jjdd�|j|jjdt�|j|jjdd�|j|jjdt�|j|jjdd	�|j|jjdt�y
)z2
        int and float values are parsed.
        z8--fooint 912 --foofloat -823.1 --eggint 32 --eggfloat 21rAi�rCg����̸��rE� rFg5@N)r-rr0r7rrRrJrKrTs  r�test_parsingValueszTypedTests.test_parsingValueszs
��N�T�T�V���
�
����%����������2�C�8����d�j�j�o�o�h�7��=����������4�f�=����d�j�j�o�o�j�9�5�A����������2�B�7����d�j�j�o�o�h�7��=����������4�d�;����d�j�j�o�o�j�9�5�Arc��|jjddg�|j|jjd�y)zw
        A dash in an option name is translated to an underscore before being
        dispatched to a handler.
        z
--under-score�fooN�rr0r7rHrs r�test_underscoreOptionz TypedTests.test_underscoreOption�s5��
	
�
�
����%� 8�9�������3�3�U�;rc��|jjddg�|j|jjd�y)zE
        An option name with a dash in it can have an alias.
        z-u�barNr\rs r�test_underscoreOptionAliasz%TypedTests.test_underscoreOptionAlias�s4��	
�
�
����u�
�.�������3�3�U�;rc��dj�}|jtj|jj|�y)z7
        Passing wrong values raises an error.
        z--fooint eggN)r-�assertRaisesr�
UsageErrorr0rTs  r�test_invalidValueszTypedTests.test_invalidValues�s4���#�#�%�����%�*�*�D�J�J�,C�,C�T�JrN)
r#r$r%r>r1rVrYr]r`rdr(rrrNrNes'���$�7�
B�<�<�KrrNc��eZdZgd�gZy)�WrongTypedOptions)�barwrongNNzBar with wrong coerce�heN)r#r$r%r&r(rrrfrf�s
��L�M�Mrrfc�4�eZdZd�Zd�ZddddegddddeggZy)�WeirdCallableOptionsc��td��)N�Ouch)�RuntimeError�r!s r�_barzWeirdCallableOptions._bar�s
���6�"�"rc��td��)N�Yay)�
ValueErrorrns r�_foozWeirdCallableOptions._foo�s
�����rrgNzBar with strange callable�foowrongzFoo with strange callable)r#r$r%rorsr&r(rrrjrj�s3��#� �
�T�4�!<�d�C�	�T�4�!<�d�C��Mrrjc�"�eZdZdZd�Zd�Zd�Zy)�WrongTypedTestszF
    Test L{usage.Options.parseOptions} for wrong coerce options.
    c�z�t�}dj�}|jt|j|�y)z2
        Using a non-callable type fails.
        z--barwrong eggN)rfr-rb�	TypeErrorr0�r�usrUs   r�test_nonCallablez WrongTypedTests.test_nonCallable�s0���
 ���%�%�'�����)�R�_�_�d�;rc�>�t�}g}|j|�y)zP
        The coerce functions are not called if no values are provided.
        N)rjr0rys   r�test_notCalledInDefaultz'WrongTypedTests.test_notCalledInDefault�s��"�
#����
����rc�:�t�}dj�}|jtj|j
|�}|j
t|�d�t�}dj�}|jt|j
|�y)zI
        Errors raised by coerce functions are handled properly.
        z--foowrong blahz&Parameter type enforcement failed: Yayz--barwrong blahN)	rjr-rbrrcr0r7�strrm)rrzrU�es    r�test_weirdCallablez"WrongTypedTests.test_weirdCallable�sy��"�
#�� �&�&�(�����e�.�.�����F������Q��!I�J�
!�
#�� �&�&�(�����,�����>rN)r#r$r%r>r{r}r�r(rrrvrv�s���<��
?rrvc��eZdZd�Zy)�OutputTestsc��t�}|jtj|jdg�}|jt
|�d�y)zF
        Error output case adjustment does not mangle options
        z-Zzoption -Z not recognizedN)rrbrrcr0r7r)r�optr�s   r�test_uppercasingzOutputTests.test_uppercasing�sB���m�����e�.�.��0@�0@�4�&�I������Q��!;�<rN)r#r$r%r�r(rrr�r��s��=rr�c��eZdZdgZdgZy)�InquisitionOptions)�expectr�)�torture-device�t�comfy-chairzset preferred torture deviceN)r#r$r%r'r&r(rrr�r��s����H�	O��Mrr�c��eZdZddgZy)�HolyQuestOptions)�	horseback�hzuse a horse)�	for-grail�gN)r#r$r%r'r(rrr�r��s��)���Hrr�c�*�eZdZdgZddedfddedfgZy)	�SubCommandOptions)�europian-swallowNz$set default swallow type to Europian�inquisition�inquestzPerform an inquisition�	holyquest�questzEmbark upon a holy questN)r#r$r%r'r�r��subCommandsr(rrr�r��s1��J��H�
�	�#5�7O�P�	�g�/�1K�L��Krr�c�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�SubCommandTestszJ
    Test L{usage.Options.parseOptions} for options with subcommands.
    c�X�t�}|jddg�|j|d�|j|jd�|j|jt�|j|jd�|j|jdd�y)z-
        A subcommand is recognized.
        �--europian-swallowr�r�r�r�r�N)	r�r0�
assertTruer7�
subCommandrR�
subOptionsr��assertFalse�rrs  r�test_simpleSubcommandz%SubCommandTests.test_simpleSubcommand�s���
���	���,�m�<�=�����,�-�.�������}�5����a�l�l�,>�?�������h�/�0�������&6�7��Grc�X�t�}|jgd��|j|d�|j|jd�|j|jt�|j|jd�|j|jdd�y)zA
        Flags and options of a subcommand are assigned.
        )r��--expect�--torture-device=featherr�r�r�r��featherN�	r�r0r�r7r�rRr�r�r�r�s  r�"test_subcommandWithFlagsAndOptionsz2SubCommandTests.test_subcommandWithFlagsAndOptionss���
���	���N�O�����-�.�/�������}�5����a�l�l�,>�?�������X�.�/�������&6�7��Crc�X�t�}|jgd��|j|d�|j|jd�|j|jt�|j|jd�|j|jdd�y)zG
        Flags and options of a subcommand alias are assigned.
        )r�r�r�r�r�r�r�r�Nr�r�s  r�'test_subcommandAliasWithFlagsAndOptionsz7SubCommandTests.test_subcommandAliasWithFlagsAndOptionss���
���	���J�K�����-�.�/�������}�5����a�l�l�,>�?�������X�.�/�������&6�7��Crc�V�t�}|jddg�|j|d�|j|jd�|j|jt�|j|jd�|j|jd�y)zG
        Flags and options of another subcommand are assigned.
        r�z--for-grailr�r�r�N)	r�r0r�r7r�rRr�r�r�r�s  r�)test_anotherSubcommandWithFlagsAndOptionsz9SubCommandTests.test_anotherSubcommandWithFlagsAndOptions#s���
���	����]�3�4�����-�.�/�������{�3����a�l�l�,<�=�������k�2�3�������[�1�2rc���t�}|jdg�|j|d�|j|j�|jt
|d��y)z�
        If no subcommand is specified and no default subcommand is assigned,
        a subcommand will not be implied.
        r�r�r�N)r�r0r�rSr�r��hasattrr�s  r�test_noSubcommandz!SubCommandTests.test_noSubcommand/sU��

���	���,�-�.�����,�-�.����!�,�,�'������L�1�2rc�d�t�}d|_|jdg�|j|d�|j	|j
d�|j
|jt�|j|jd�|j	|jdd�y)	zK
        Flags and options in the default subcommand are assigned.
        r�r�r�r�r�r�r�N)
r��defaultSubCommandr0r�r7r�rRr�r�r�r�s  r�test_defaultSubcommandz&SubCommandTests.test_defaultSubcommand:s���
���'���	���,�-�.�����,�-�.�������}�5����a�l�l�,>�?�������h�/�0�������&6�7��Grc�6��Gd�dtj��G�fd�dtj�}|�}|jdg�|jt	|j
d��|j
|j
j|�y)zw
        The parseOptions method from the Options object specified for the
        given subcommand is called.
        c��eZdZd�Zy)�DSubCommandTests.test_subCommandParseOptionsHasParent.<locals>.SubOptc�l�|j|_tjj|g|��i|��yrP)�parent�	sawParentr�Optionsr0)r�a�kws   rr0zQSubCommandTests.test_subCommandParseOptionsHasParent.<locals>.SubOpt.parseOptionsNs)��!%������
�
�*�*�4�:�!�:�r�:rN)r#r$r%r0r(rr�SubOptr�Ms��
;rr�c���eZdZddW�dfgZy)�ASubCommandTests.test_subCommandParseOptionsHasParent.<locals>.Optr[rr_N�r#r$r%r��r�s�r�Optr�Rs�����V�U�+��Krr�r[r�N)rr�r0r�r�r�r7r�)rr�rr�s   @r�$test_subCommandParseOptionsHasParentz4SubCommandTests.test_subCommandParseOptionsHasParentGsk���	;�U�]�]�	;�
	�%�-�-�	�

�E��	����w���������k�:�;�������/�/��3rc�4��Gd�dtj��G�fd�dtj�}G�fd�dtj�}|�}|jdg�|�}|jdg�|jt	|j
d	��|jt	|j
d	��|j
|j
j|�|j
|j
j|�y
)zh
        The .parent pointer is correct even when the same Options class is
        used twice.
        c��eZdZy)�:SubCommandTests.test_subCommandInTwoPlaces.<locals>.SubOptN)r#r$r%r(rrr�r�bs��rr�c���eZdZddW�dfgZy)�:SubCommandTests.test_subCommandInTwoPlaces.<locals>.OptFoor[r�quuxNr�r�s�r�OptFoor�e������V�V�,��Krr�c���eZdZddW�dfgZy)�:SubCommandTests.test_subCommandInTwoPlaces.<locals>.OptBarr_�br�Nr�r�s�r�OptBarr�jr�rr�r[r_r�N)rr�r0r�r�r��failUnlessIdenticalr�)rr�r��oFoo�oBarr�s     @r�test_subCommandInTwoPlacesz*SubCommandTests.test_subCommandInTwoPlaces\s����	�U�]�]�	�	�U�]�]�	�
	�U�]�]�	�
�x�����5�'�"��x�����5�'�"���������:�;���������:�;�� � ����!7�!7��>�� � ����!7�!7��>rN)r#r$r%r>r�r�r�r�r�r�r�r�r(rrr�r��s3���
H�
D�
D�
3�	3�H�4�*?rr�c�"�eZdZdZd�Zd�Zd�Zy)�HelpStringTestsz&
    Test generated help strings.
    c�L�dj�|_t�|_y)z;
        Instantiate a well-behaved Options class.
        r,N)r-r.rr/rs rr1zHelpStringTests.setUp~s!��
V�
�%�'�	
�
� �M��	rc��	|jj�y#t$r}|j|�Yd}~yd}~wwxYw)z,
        __str__ shouldn't go boom.
        N)r/�__str__�	Exception�fail)rr�s  r�
test_noGoBoomzHelpStringTests.test_noGoBoom�s4��	��I�I������	��I�I�a�L�L��	�s��	A�<�Ac��t|j�j�D�cgc]}|jd�dk\s�|��}}|j	t|�dkD�|j	|djd�dk\�ycc}w)zK
        Extra whitespace in flag and parameters docs is stripped.
        rr�
flagalliciousN)rr/�
splitlines�findr��len)r�s�liness   r�&test_whitespaceStripFlagsAndParametersz6HelpStringTests.test_whitespaceStripFlagsAndParameters�so�� ��	�	�N�5�5�7�P�q�1�6�6�'�?�a�;O��P��P�����E�
�Q��'�����a��
�
�o�6�!�;�<��Qs�B
�B
N)r#r$r%r>r1r�r�r(rrr�r�ys���	"��=rr�c��eZdZdZd�Zd�Zy)�PortCoerceTestsz3
    Test the behavior of L{usage.portCoerce}.
    c���|jdtjd��|jdtjd��|jdtjd��y)z4
        Test the answers with valid input.
        r�0i��3210i���65535N)r7r�
portCoercers r�test_validCoercez PortCoerceTests.test_validCoerce�sU��	
����E�,�,�S�1�2�����u�/�/��7�8������ 0� 0�� 9�:rc�,�|jttjd�|jttjd�|jttjd�|jttjd�y)z"
        Test error path.
        �z-21�212189r[N)rbrrrr�rs r�test_errorCoercez PortCoerceTests.test_errorCoerce�sd��	
���*�e�&6�&6��;����*�e�&6�&6��>����*�e�&6�&6��A����*�e�&6�&6��>rN)r#r$r%r>r�r�r(rrr�r��s���;�?rr�c�L�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�ZshCompleterTestsz�
    Test the behavior of the various L{twisted.usage.Completer} classes
    for producing output usable by zsh tab-completion system.
    c�"�tj�}|jdtj�}|j	|d�tjdd��}|jdtj�}|j	|d�y)zX
        Completer produces zsh shell-code that produces no completion matches.
        �some-optionz
:some-option:�some actionT��descr�repeat�*:some action:N)r�	Completer�
_shellCode�_ZSHr7�r�c�gots   r�test_completerz ZshCompleterTests.test_completer�si��
�O�O����l�l�=�%�*�*�5������o�.��O�O�-��=���l�l�=�%�*�*�5������.�/rc��tj�}|jdtj�}|j	|d�tjd�}|jdtj�}|j	|d�tjddd��}|jdtj�}|j	|d�y	)
zn
        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�r7r�s   r�
test_fileszZshCompleterTests.test_files�s���

���!���l�l�=�%�*�*�5������>�?�����'���l�l�=�%�*�*�5������D�E�����m�D�I���l�l�=�%�*�*�5������E�Frc�"�tj�}|jdtj�}|j	|d�tjdd��}|jdtj�}|j	|d�y)zV
        CompleteDirs produces zsh shell-code that completes directory names.
        r�z:some-option:_directoriesr�Tr�z*:some action:_directoriesN)r�CompleteDirsr�r�r7r�s   r�	test_dirszZshCompleterTests.test_dirs�sn��
��� ���l�l�=�%�*�*�5������9�:����]�4�@���l�l�=�%�*�*�5������:�;rc��tjd�}|jdtj�}|j	|d�tjgd��}|jdtj�}|j	|d�tjgd�dd��}|jdtj�}|j	|d	�y
)zw
        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�r7r�s   r�	test_listzZshCompleterTests.test_list�s���

���u�%���l�l�=�%�*�*�5������4�5�����/���l�l�=�%�*�*�5������4�5�����m�D�Q���l�l�=�%�*�*�5������5�6rc��tjd�}|jdtj�}|j	|d�tjgd��}|jdtj�}|j	|d�tjgd�dd��}|jdtj�}d	}|j	||�y
)z�
        CompleteMultiList produces zsh shell-code that completes multiple
        comma-separated words from a fixed list of possibilities.
        rr�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�r7)rr�r��expecteds    r�test_multiListz ZshCompleterTests.test_multiList�s���

�#�#�E�*���l�l�=�%�*�*�5������M�N��#�#�O�4���l�l�=�%�*�*�5������M�N��#�#�O�=�QU�V���l�l�=�%�*�*�5��C������h�'rc�"�tj�}|jdtj�}|j	|d�tjdd��}|jdtj�}|j	|d�y)zd
        CompleteUsernames produces zsh shell-code that completes system
        usernames.
        r�z:some-option:_usersr�Tr�z*:some action:_usersN)r�CompleteUsernamesr�r�r7�rr��outs   r�test_usernamesz ZshCompleterTests.test_usernamessn��

�#�#�%���l�l�=�%�*�*�5������3�4��#�#�-��E���l�l�=�%�*�*�5������4�5rc�"�tj�}|jdtj�}|j	|d�tjdd��}|jdtj�}|j	|d�y)zc
        CompleteGroups produces zsh shell-code that completes system group
        names.
        r�z:group:_groupsr�Tr�z*:some action:_groupsN)r�CompleteGroupsr�r�r7rs   r�test_groupszZshCompleterTests.test_groupssn��

� � �"���l�l�=�%�*�*�5������.�/�� � �}�T�B���l�l�=�%�*�*�5������5�6rc�"�tj�}|jdtj�}|j	|d�tjdd��}|jdtj�}|j	|d�y)zU
        CompleteHostnames produces zsh shell-code that completes hostnames.
        r�z:some-option:_hostsr�Tr�z*:some action:_hostsN)r�CompleteHostnamesr�r�r7rs   r�test_hostnamesz ZshCompleterTests.test_hostnames sn��
�#�#�%���l�l�=�%�*�*�5������3�4��#�#�-��E���l�l�=�%�*�*�5������4�5rc�Z�tj�}|jdtj�}|j	|jd��tjdd��}|jdtj�}|j	|jd��y)z�
        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��
startswithrs   r�test_userAtHostz!ZshCompleterTests.test_userAtHost,sx��

�$�$�&���l�l�=�%�*�*�5��������';�<�=��$�$�=��F���l�l�=�%�*�*�5��������'7�8�9rc�"�tj�}|jdtj�}|j	|d�tjdd��}|jdtj�}|j	|d�y)zv
        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�r7rs   r�test_netInterfacesz$ZshCompleterTests.test_netInterfaces9sn��

�'�'�)���l�l�=�%�*�*�5������<�=��'�'�m�D�I���l�l�=�%�*�*�5������=�>rN)r#r$r%r>rrrrrrrrr!r$r(rrr�r��s:���

0�G�"
<�7�"(�$6�7�
6�:�?rr�c��eZdZdZd�Zy)�CompleterNotImplementedTestszs
    Using an unknown shell constant with the various Completer() classes
    should raise NotImplementedError
    c
���tjtjtjtjtj
tjtjtjtjtjg
}|D],}	|�}|jt|jdd��.y#t$r|d�}Y�8wxYw)zM
        Using an unknown shellType should raise NotImplementedError
        N�bad_shell_type)rr�rrr
rrrrrr#�
BaseExceptionrb�NotImplementedErrorr�)r�classes�cls�actions    r�test_unknownShellz.CompleterNotImplementedTests.test_unknownShellMs���

�O�O�����������#�#��#�#�� � ��#�#��$�$��'�'�
���	�C�
#����
���#�V�%6�%6��>N�
�	��!�
#��T���
#�s�C�C�CN)r#r$r%r>r.r(rrr&r&Gs���
rr&c�<�eZdZdZGd�d�Zd�Zd�Zd�Zd�Zy)	�FlagFunctionTestsz*
    Tests for L{usage.flagFunction}.
    c�"�eZdZdZd�Zd�Zd�Zy)�FlagFunctionTests.SomeClassz>
        Dummy class for L{usage.flagFunction} tests.
        c��y)z�
            A one argument method to be tested by L{usage.flagFunction}.

            @param a: a useless argument to satisfy the function's signature.
            Nr()rr�s  r�oneArgz"FlagFunctionTests.SomeClass.oneArgr��rc��y)zU
            A no argument method to be tested by L{usage.flagFunction}.
            Nr(rs r�noArgz!FlagFunctionTests.SomeClass.noArgyr5rc��y)aG
            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()rr�r�r�s    r�manyArgsz$FlagFunctionTests.SomeClass.manyArgs~r5rN)r#r$r%r>r4r7r9r(rr�	SomeClassr2ms��	�	�	�
	rr:c�~�|jdtj|j�j��y)zs
        L{usage.flagFunction} returns C{False} if the method checked allows
        exactly one argument.
        FN)�assertIsr�flagFunctionr:r4rs r�test_hasArgzFlagFunctionTests.test_hasArg�s*��
	
�
�
�e�U�/�/����0@�0G�0G�H�Irc�~�|jdtj|j�j��y)zq
        L{usage.flagFunction} returns C{True} if the method checked allows
        exactly no argument.
        TN)r<rr=r:r7rs r�
test_noArgzFlagFunctionTests.test_noArg�s*��
	
�
�
�d�E�.�.�t�~�~�/?�/E�/E�F�Grc���|jtjtj|j	�j
�}|j
dt|��y)z
        L{usage.flagFunction} raises L{usage.UsageError} if the method checked
        allows more than one argument.
        z$Invalid Option function for manyArgsN�rbrrcr=r:r9r7r�r�excs  r�test_tooManyArgumentsz'FlagFunctionTests.test_tooManyArguments�sK��
������e�0�0�$�.�.�2B�2K�2K�
��	
���?��S��Jrc���|jtjtj|j	�j
d�}|j
dt|��y)z�
        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 flubudufNrBrCs  r�,test_tooManyArgumentsAndSpecificErrorMessagez>FlagFunctionTests.test_tooManyArgumentsAndSpecificErrorMessage�sM��
������e�0�0�$�.�.�2B�2K�2K�Z�
��	
���?��S��JrN)	r#r$r%r>r:r>r@rErHr(rrr0r0hs)�����4J�H�K�Krr0c��eZdZdZd�Zy)�OptionsInternalTestsz6
    Tests internal behavior of C{usage.Options}.
    c���Gd�dtj�}|�}|jtj	gd�d�|j
d|j
d|j
dd��y)zs
        Options which are synonyms to another option are aliases towards the
        longest option name.
        c��eZdZd�ZeZeZy)�;OptionsInternalTests.test_optionsAliasesOrder.<locals>.Optsc��y)z~
                This is an option method with a very long name, that is going to
                be aliased.
                Nr(rs r�opt_very_very_longzNOptionsInternalTests.test_optionsAliasesOrder.<locals>.Opts.opt_very_very_long�r5rN)r#r$r%rO�	opt_short�opt_sr(rr�OptsrM�s��
�+�I�&�ErrR)r��short�very-very-longrTr�rSN)rr�r7�dict�fromkeys�synonyms)rrRrs   r�test_optionsAliasesOrderz-OptionsInternalTests.test_optionsAliasesOrder�sc��	'�5�=�=�	'��v������M�M�:�<L�M��]�]�3�'����w�/�"&�-�-�0@�"A�
�	
rN)r#r$r%r>rXr(rrrJrJ�s���
rrJN)r>�twisted.pythonr�
twisted.trialrr�r�TestCaser*r@rNrfrjrvr�r�r�r�r�r�r�r�r&r0rJr(rr�<module>r\s\���
!�"�7�%�-�-�7�6(I�H�-�-�(I�V�5�=�=��$8K��"�"�8K�vN��
�
�N�
�5�=�=�
�"?�h�'�'�"?�J=�(�#�#�=�������u�}�}����
�
��|?�h�'�'�|?�~!=�h�'�'�!=�H?�h�'�'�?�.P?��)�)�P?�f�8�#4�#4��B?K��)�)�?K�D
�8�,�,�
r

Zerion Mini Shell 1.0