%PDF- %PDF-
Mini Shell

Mini Shell

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

�

?��^����dZddlmZmZddlmZddlmZmZm	Z	m
Z
mZmZGd�de�Z
Gd�de�ZGd	�d
ee�ZGd�dee�ZGd
�de�ZGd�deee�ZGd�dee�ZGd�dee�ZGd�dee�ZGd�dee�ZGd�de�ZGd�de�ZGd�de�ZGd�d e
�ZGd!�d"e�Zy#)$z
Unit tests for L{constantly}.
�)�division�absolute_import)�TestCase)�
NamedConstant�Names�
ValueConstant�Values�FlagConstant�Flagsc�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�NamedConstantTestszk
    Tests for the L{constantly.NamedConstant} class which is used
    to represent individual values.
    c�0�Gd�dt�}||_y)zN
        Create a dummy container into which constants can be placed.
        c��eZdZy)�%NamedConstantTests.setUp.<locals>.fooN)�__name__�
__module__�__qualname__���@/usr/lib/python3/dist-packages/constantly/test/test_constants.py�foors��rrN)r�	container)�selfrs  r�setUpzNamedConstantTests.setUps��	�%�	���rc��t�}|j|jdd�|jd|j�y)z�
        The C{name} attribute of a L{NamedConstant} refers to the value passed
        for the C{name} parameter to C{_realize}.
        �barN)r�_realizer�assertEqual�name�rrs  r�	test_namezNamedConstantTests.test_name s3��
����
�
�d�n�n�e�T�2������	�	�*rc��t�}|j|jdd�|jdt	|��y)z�
        The string representation of an instance of L{NamedConstant} includes
        the container the instances belongs to as well as the instance's name.
        rNz	<foo=bar>)rrrr�reprr s  r�test_representationz&NamedConstantTests.test_representation*s3��
����
�
�d�n�n�e�T�2�����d�4�j�1rc��t�}|j|jdd�|j||k(�|j	||k7�y)zG
        A L{NamedConstant} instance compares equal to itself.
        rN)rrr�
assertTrue�assertFalser s  r�
test_equalityz NamedConstantTests.test_equality4sA������
�
�d�n�n�e�T�2�������%�������&rc���t�}|j|jdd�t�}|j|jdd�|j||k(�|j	||k7�y)zf
        Two different L{NamedConstant} instances do not compare equal to each
        other.
        rN)rrrr'r&�r�first�seconds   r�test_nonequalityz#NamedConstantTests.test_nonequality>s\��
���
���t�~�~�u�d�3�����������t�4�����&��)�������(rc���t�}|j|jdd�t�}|j|jdd�|jt	|�t	|��y)z�
        Because two different L{NamedConstant} instances do not compare as
        equal to each other, they also have different hashes to avoid
        collisions when added to a C{dict} or C{set}.
        rN)rrr�assertNotEqual�hashr*s   r�	test_hashzNamedConstantTests.test_hashKsR�����
���t�~�~�u�d�3�����������t�4����D��K��f��6rN)
rrr�__doc__rr!r$r(r-r1rrrr
r
s%����+�2�'�
)�
7rr
c��eZdZdZd�Zd�Zy)�_ConstantsTestsMixinz\
    Mixin defining test helpers common to multiple types of constants
    collections.
    c�l�|jt|�}|j|dzt|��y)z�
        Assert that an attempt to instantiate the constants class raises
        C{TypeError}.

        @param name: A C{str} giving the name of the constants collection.
        @param cls: The constants class to test.
        z may not be instantiated.N)�assertRaises�	TypeErrorr�str)rr�cls�excs    r�_notInstantiableTestz)_ConstantsTestsMixin._notInstantiableTest^s0�����	�3�/������ ;�;�S��X�Frc�p�|j}t||�|j}|j||�y)a[
        Assert that C{container._enumerants} does not change as a side-effect
        of one of its attributes being accessed.

        @param container: A L{_ConstantsContainer} subclass which will be
            tested.
        @param constantName: The name of one of the constants which is an an
            attribute of C{container}.
        N)�_enumerants�getattr�assertIdentical)rr�constantNamer+r,s     r�_initializedOnceTestz)_ConstantsTestsMixin._initializedOnceTestjs6���%�%��	�	�<�(��&�&�����U�F�+rN)rrrr2r;rArrrr4r4Ys���	G�,rr4c�p�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�
NamesTestsz_
    Tests for L{constantly.Names}, a base class for containers of
    related constaints.
    c�0�Gd�dt�}||_y)z�
        Create a fresh new L{Names} subclass for each unit test to use.  Since
        L{Names} is stateful, re-using the same subclass across test methods
        makes exercising all of the implementation code paths difficult.
        c�V�eZdZdZe�Ze�Ze�Ze�Ze	�Z
y)� NamesTests.setUp.<locals>.METHODzm
            A container for some named constants to use in unit tests for
            L{Names}.
            N)rrrr2r�GET�PUT�POST�DELETE�object�extrarrr�METHODrF�s,��
� �/�C��/�C� �?�D�"�_�F��H�ErrMN)rrM)rrMs  rrzNamesTests.setUp�s��
	�U�
	���rc�<�|jd|j�y)zm
        A subclass of L{Names} raises C{TypeError} if an attempt is made to
        instantiate it.
        rMN)r;rM�rs r�test_notInstantiablezNamesTests.test_notInstantiable����
	
�!�!�(�D�K�K�8rc�,�|jt|jd��|jt|jd��|jt|jd��|jt|jd��y)z�
        Each name associated with a L{NamedConstant} instance in the definition
        of a L{Names} subclass is available as an attribute on the resulting
        class.
        rGrHrIrJN)r&�hasattrrMrOs r�test_symbolicAttributesz"NamesTests.test_symbolicAttributes�s`��	
�������U�3�4��������U�3�4��������V�4�5��������X�6�7rc�N�|jt|jd��y)z�
        As usual, names not defined in the class scope of a L{Names}
        subclass are not available as attributes on the resulting class.
        rN)r'rSrMrOs r�test_withoutOtherAttributesz&NamesTests.test_withoutOtherAttributes����
	
�������e�4�5rc�b�|jdt|jj��y)z�
        The string representation of a constant on a L{Names} subclass includes
        the name of the L{Names} subclass and the name of the constant itself.
        z<METHOD=GET>N)rr#rMrGrOs rr$zNamesTests.test_representation�s!��
	
�����d�k�k�o�o�)>�?rc��|jjd�}|j|jj|�y)zQ
        Constants can be looked up by name using L{Names.lookupByName}.
        rGN)rM�lookupByNamer?rG�r�methods  r�test_lookupByNamezNamesTests.test_lookupByName�s0�����)�)�%�0�����T�[�[�_�_�f�5rc�\�|jt|jjd�|jt|jjd�|jt|jjd�|jt|jjd�y)z}
        Names not defined with a L{NamedConstant} instance cannot be looked up
        using L{Names.lookupByName}.
        rZ�__init__rrLN)r6�
ValueErrorrMrZrOs r�test_notLookupMissingByNamez&NamesTests.test_notLookupMissingByName�st��
	
���*�d�k�k�&>�&>��O����*�d�k�k�&>�&>�
�K����*�d�k�k�&>�&>��F����*�d�k�k�&>�&>��Hrc�d�|jd|jjj�y)zi
        The C{name} attribute of one of the named constants gives that
        constant's name.
        rGN)rrMrGrrOs rr!zNamesTests.test_name�s"��
	
��������� 4� 4�5rc�x�|j|jj|jj�y)z�
        Repeated access of an attribute associated with a L{NamedConstant}
        value in a L{Names} subclass results in the same object.
        N)r?rMrGrOs r�test_attributeIdentityz!NamesTests.test_attributeIdentity�s$��
	
���T�[�[�_�_�d�k�k�o�o�>rc��t|jj��}|j|jj|jj
|jj|jjg|�y)z�
        L{Names.iterconstants} returns an iterator over all of the constants
        defined in the class, in the order they were defined.
        N)�listrM�
iterconstantsrrGrHrIrJ�r�	constantss  r�test_iterconstantszNamesTests.test_iterconstants�s_��
����2�2�4�5�	����
�[�[�_�_�d�k�k�o�o�
�[�[�
�
�t�{�{�1�1�
3��	rc��t|jj��}|j|jj|d�|j|jj
|d�|j|jj|d�|j|jj|d�y)z�
        The constants returned from L{Names.iterconstants} are identical to the
        constants accessible using attributes.
        r���N)rfrMrgr?rGrHrIrJrhs  r�#test_attributeIterconstantsIdentityz.NamesTests.test_attributeIterconstantsIdentity�s���
����2�2�4�5�	����T�[�[�_�_�i��l�;����T�[�[�_�_�i��l�;����T�[�[�-�-�y��|�<����T�[�[�/�/��1��>rc�P�t|jj��}t|jj��}|j|d|d�|j|d|d�|j|d|d�|j|d|d�y)zw
        The constants returned from L{Names.iterconstants} are identical on
        each call to that method.
        rrlrmrnN)rfrMrgr?�rri�agains   r�test_iterconstantsIdentityz%NamesTests.test_iterconstantsIdentity�s���
����2�2�4�5�	��T�[�[�.�.�0�1�����U�1�X�y��|�4����U�1�X�y��|�4����U�1�X�y��|�4����U�1�X�y��|�4rc�<�|j|jd�y)zn
        L{Names._enumerants} is initialized once and its value re-used on
        subsequent access.
        rGN)rArMrOs r�test_initializedOncezNamesTests.test_initializedOnces��
	
�!�!�$�+�+�u�5rc���G�fd�dt�}�j�jj|j�y)z�
        A constant defined on a L{Names} subclass may be set as an attribute of
        another class and then retrieved using that attribute.
        c�<��eZdZW�jjZy)�8NamesTests.test_asForeignClassAttribute.<locals>.AnotherN�rrrrMrG�	somethingrOs�r�Anotherrx���������Irr{N�rKr?rMrGrz�rr{s` r�test_asForeignClassAttributez'NamesTests.test_asForeignClassAttribute
s/���
	(�f�	(�	
���T�[�[�_�_�g�.?�.?�@rc���G�fd�dt�}�j�jj|�j�y)z�
        A constant defined on a L{Names} subclass may be set as an attribute of
        another class and then retrieved from an instance of that class using
        that attribute.
        c�<��eZdZW�jjZy)�CNamesTests.test_asForeignClassAttributeViaInstance.<locals>.AnotherNryrOs�rr{r�r|rr{Nr}r~s` r�'test_asForeignClassAttributeViaInstancez2NamesTests.test_asForeignClassAttributeViaInstances1���	(�f�	(�	
���T�[�[�_�_�g�i�.A�.A�Brc�r���fd�}�jt|�}�jdt|��y)z�
        It is explicitly disallowed (via a L{ValueError}) to use a constant
        defined on a L{Names} subclass as the value of an attribute of another
        L{Names} subclass.
        c�(��G�fd�dt�}y)Nc�<��eZdZW�jjZy)�XNamesTests.test_notAsAlternateContainerAttribute.<locals>.defineIt.<locals>.AnotherNamesNryrOs�r�AnotherNamesr�+s��� �K�K�O�O�	rr�)r)r�rs �r�defineItzBNamesTests.test_notAsAlternateContainerAttribute.<locals>.defineIt*s���
,�u�
,rzDCannot use <METHOD=GET> as the value of an attribute on AnotherNamesN)r6r`rr8)rr�r:s`  r�%test_notAsAlternateContainerAttributez0NamesTests.test_notAsAlternateContainerAttribute$s6���	,����
�H�5�����
���H�	rN)rrrr2rrPrTrVr$r]rar!rdrjrorsrurr�r�rrrrCrCs[����*9�	8�6�@�6�I�6�?�	�	?�
5�6�A�	C�rrCc�p�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�ValuesTestszu
    Tests for L{constantly.Names}, a base class for containers of
    related constaints with arbitrary values.
    c�0�Gd�dt�}||_y)z�
        Create a fresh new L{Values} subclass for each unit test to use.  Since
        L{Values} is stateful, re-using the same subclass across test methods
        makes exercising all of the implementation code paths difficult.
        c�,�eZdZed�Zed�Zy)�!ValuesTests.setUp.<locals>.STATUS�200�404N)rrrr�OK�	NOT_FOUNDrrr�STATUSr�As���u�%�B�%�e�,�Irr�N)r	r�)rr�s  rrzValuesTests.setUp;s��	-�V�	-���rc�<�|jd|j�y)zn
        A subclass of L{Values} raises C{TypeError} if an attempt is made to
        instantiate it.
        r�N)r;r�rOs rrPz ValuesTests.test_notInstantiableHrQrc��|jt|jd��|jt|jd��y)z�
        Each name associated with a L{ValueConstant} instance in the definition
        of a L{Values} subclass is available as an attribute on the resulting
        class.
        r�r�N)r&rSr�rOs rrTz#ValuesTests.test_symbolicAttributesPs2��	
�������T�2�3��������[�9�:rc�N�|jt|jd��y)z�
        As usual, names not defined in the class scope of a L{Values}
        subclass are not available as attributes on the resulting class.
        rN)r'rSr�rOs rrVz'ValuesTests.test_withoutOtherAttributesZrWrc�b�|jdt|jj��y)z�
        The string representation of a constant on a L{Values} subclass
        includes the name of the L{Values} subclass and the name of the
        constant itself.
        z<STATUS=OK>N)rr#r�r�rOs rr$zValuesTests.test_representationbs!��	
�����T�[�[�^�^�(<�=rc��|jjd�}|j|jj|�y)zR
        Constants can be looked up by name using L{Values.lookupByName}.
        r�N)r�rZr?r�r[s  rr]zValuesTests.test_lookupByNameks0�����)�)�$�/�����T�[�[�^�^�V�4rc��|jt|jjd�|jt|jjd�|jt|jjd�y)z~
        Names not defined with a L{ValueConstant} instance cannot be looked up
        using L{Values.lookupByName}.
        rZr_rN)r6r`r�rZrOs rraz'ValuesTests.test_notLookupMissingByNamessX��
	
���*�d�k�k�&>�&>��O����*�d�k�k�&>�&>�
�K����*�d�k�k�&>�&>��Frc��|jjd�}|j|jj|�y)z�
        Constants can be looked up by their associated value, defined by the
        argument passed to L{ValueConstant}, using L{Values.lookupByValue}.
        r�N)r��
lookupByValuer?r�)r�statuss  r�test_lookupByValuezValuesTests.test_lookupByValue}s0��
���*�*�5�1�����T�[�[�^�^�V�4rc�x�Gd�dt�}|j|jd�|j�y)z�
        If more than one constant is associated with a particular value,
        L{Values.lookupByValue} returns whichever of them is defined first.
        c�0�eZdZdZed�Zed�Zy)�BValuesTests.test_lookupDuplicateByValue.<locals>.TRANSPORT_MESSAGEzF
            Message types supported by an SSH transport.
            �N)rrrr2r�KEX_DH_GEX_REQUEST_OLD�
KEXDH_INITrrr�TRANSPORT_MESSAGEr��s��
�&3�2�%6�"�&�r�*�Jrr�r�N)r	r?r�r�)rr�s  r�test_lookupDuplicateByValuez'ValuesTests.test_lookupDuplicateByValue�s5��
	+��	+�	
����+�+�B�/��4�4�	6rc��|jt|jjd�|jt|jjd�|jt|jjd�y)z�
        L{Values.lookupByValue} raises L{ValueError} when called with a value
        with which no constant is associated.
        r���z200.1N)r6r`r�r�rOs r�test_notLookupMissingByValuez(ValuesTests.test_notLookupMissingByValue�sX��
	
���*�d�k�k�&?�&?��F����*�d�k�k�&?�&?��E����*�d�k�k�&?�&?��Irc�d�|jd|jjj�y)�c
        The C{name} attribute of one of the constants gives that constant's
        name.
        r�N)rr�r�rrOs rr!zValuesTests.test_name�s"��
	
����t�{�{�~�~�2�2�3rc�x�|j|jj|jj�y)z�
        Repeated access of an attribute associated with a L{ValueConstant}
        value in a L{Values} subclass results in the same object.
        N)r?r�r�rOs rrdz"ValuesTests.test_attributeIdentity�s$��
	
���T�[�[�^�^�T�[�[�^�^�<rc���t|jj��}|j|jj|jj
g|�y)z�
        L{Values.iterconstants} returns an iterator over all of the constants
        defined in the class, in the order they were defined.
        N)rfr�rgrr�r�rhs  rrjzValuesTests.test_iterconstants�sF��
����2�2�4�5�	����
�[�[�^�^�T�[�[�2�2�3��	rc���t|jj��}|j|jj|d�|j|jj
|d�y)z�
        The constants returned from L{Values.iterconstants} are identical to
        the constants accessible using attributes.
        rrlN)rfr�rgr?r�r�rhs  rroz/ValuesTests.test_attributeIterconstantsIdentity�sU��
����2�2�4�5�	����T�[�[�^�^�Y�q�\�:����T�[�[�2�2�I�a�L�Arc���t|jj��}t|jj��}|j|d|d�|j|d|d�y)zx
        The constants returned from L{Values.iterconstants} are identical on
        each call to that method.
        rrlN)rfr�rgr?rqs   rrsz&ValuesTests.test_iterconstantsIdentity�sb��
����2�2�4�5�	��T�[�[�.�.�0�1�����U�1�X�y��|�4����U�1�X�y��|�4rc�<�|j|jd�y)zo
        L{Values._enumerants} is initialized once and its value re-used on
        subsequent access.
        r�N)rAr�rOs rruz ValuesTests.test_initializedOnce�s��
	
�!�!�$�+�+�t�4rN)rrrr2rrPrTrVr$r]rar�r�r�r!rdrjrorsrurrrr�r�6sZ���
�9�;�6�>�5�G�5�6�"J�4�=��B�5�5rr�c��eZdZdZd�Zy)�_FlagsTestsMixinz�
    Mixin defining setup code for any tests for L{Flags} subclasses.

    @ivar FXF: A L{Flags} subclass created for each test method.
    c�0�Gd�dt�}||_y)z�
        Create a fresh new L{Flags} subclass for each unit test to use.  Since
        L{Flags} is stateful, re-using the same subclass across test methods
        makes exercising all of the implementation code paths difficult.
        c�T�eZdZe�Ze�Ze�Zed�Ze�Zy)�#_FlagsTestsMixin.setUp.<locals>.FXF� N)	rrrr
�READ�WRITE�APPEND�	EXCLUSIVE�TEXTrrr�FXFr��s,���>�D� �N�E�!�^�F�%�T�*�I� �>�Drr�N)rr�)rr�s  rrz_FlagsTestsMixin.setUp�s��	"�%�	"���rN)rrrr2rrrrr�r��s���
rr�c�j�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zy)�
FlagsTestsz�
    Tests for L{constantly.Flags}, a base class for containers of
    related, combinable flag or bitvector-like constants.
    c�<�|jd|j�y)zm
        A subclass of L{Flags} raises L{TypeError} if an attempt is made to
        instantiate it.
        r�N)r;r�rOs rrPzFlagsTests.test_notInstantiable�s��
	
�!�!�%����2rc�v�|jt|jd��|jt|jd��|jt|jd��|jt|jd��|jt|jd��y)z�
        Each name associated with a L{FlagConstant} instance in the definition
        of a L{Flags} subclass is available as an attribute on the resulting
        class.
        r�r�r�r�r�N)r&rSr�rOs rrTz"FlagsTests.test_symbolicAttributessw��	
�������&�1�2��������'�2�3��������(�3�4��������+�6�7��������&�1�2rc�N�|jt|jd��y)z�
        As usual, names not defined in the class scope of a L{Flags} subclass
        are not available as attributes on the resulting class.
        rN)r'rSr�rOs rrVz&FlagsTests.test_withoutOtherAttributess��
	
�������5�1�2rc�b�|jdt|jj��y)z�
        The string representation of a constant on a L{Flags} subclass includes
        the name of the L{Flags} subclass and the name of the constant itself.
        z
<FXF=READ>N)rr#r�r�rOs rr$zFlagsTests.test_representations!��
	
����t�D�H�H�M�M�':�;rc��|jjd�}|j|jj|�y)zQ
        Constants can be looked up by name using L{Flags.lookupByName}.
        r�N)r�rZr?r��r�flags  rr]zFlagsTests.test_lookupByName!s0���x�x�$�$�V�,�����T�X�X�]�]�D�1rc��|jt|jjd�|jt|jjd�|jt|jjd�y)z|
        Names not defined with a L{FlagConstant} instance cannot be looked up
        using L{Flags.lookupByName}.
        rZr_rN)r6r`r�rZrOs rraz&FlagsTests.test_notLookupMissingByName)sX��
	
���*�d�h�h�&;�&;�^�L����*�d�h�h�&;�&;�Z�H����*�d�h�h�&;�&;�U�Crc��|jjd�}|j||jj�|jjd�}|j||jj�|jjd�}|j||jj
�|jjd�}|j||jj�|jjd�}|j||jj�y)z�
        Constants can be looked up by their associated value, defined
        implicitly by the position in which the constant appears in the class
        definition or explicitly by the argument passed to L{FlagConstant}.
        rlrm�r��@N)r�r�r?r�r�r�r�r�r�s  rr�zFlagsTests.test_lookupByValue3s����x�x�%�%�d�+�����T�4�8�8�=�=�1��x�x�%�%�d�+�����T�4�8�8�>�>�2��x�x�%�%�d�+�����T�4�8�8�?�?�3��x�x�%�%�d�+�����T�4�8�8�#5�#5�6��x�x�%�%�d�+�����T�4�8�8�=�=�1rc�x�Gd�dt�}|j|jd�|j�y)z�
        If more than one constant is associated with a particular value,
        L{Flags.lookupByValue} returns whichever of them is defined first.
        c�,�eZdZed�Zed�Zy)�5FlagsTests.test_lookupDuplicateByValue.<locals>.TIMEXrlN)rrrr
�
ADJ_OFFSET�
MOD_OFFSETrrr�TIMEXr�Ns��%�f�-�J�&�f�-�Jrr�rlN)rr?r�r�)rr�s  rr�z&FlagsTests.test_lookupDuplicateByValueIs1��
	.�E�	.�	
���U�0�0��8�%�:J�:J�Krc�Z�|jt|jjd�y)z�
        L{Flags.lookupByValue} raises L{ValueError} when called with a value
        with which no constant is associated.
        �N)r6r`r�r�rOs rr�z'FlagsTests.test_notLookupMissingByValueXs ��
	
���*�d�h�h�&<�&<�d�Crc�d�|jd|jjj�y)r�r�N)rr�r�rrOs rr!zFlagsTests.test_name`s"��
	
���������!3�!3�4rc�x�|j|jj|jj�y)z�
        Repeated access of an attribute associated with a L{FlagConstant} value
        in a L{Flags} subclass results in the same object.
        N)r?r�r�rOs rrdz!FlagsTests.test_attributeIdentityhs$��
	
���T�X�X�]�]�D�H�H�M�M�:rc�@�t|jj��}|j|jj|jj
|jj|jj|jjg|�y)z�
        L{Flags.iterconstants} returns an iterator over all of the constants
        defined in the class, in the order they were defined.
        N)	rfr�rgrr�r�r�r�r�rhs  rrjzFlagsTests.test_iterconstantspsg��
����/�/�1�2�	����
�X�X�]�]�D�H�H�N�N�D�H�H�O�O�
�X�X�
�
������
0��	rc���t|jj��}|j|jj|d�|j|jj
|d�|j|jj|d�|j|jj|d�|j|jj|d�y)z�
        The constants returned from L{Flags.iterconstants} are identical to the
        constants accessible using attributes.
        rrlrmrnr�N)	rfr�rgr?r�r�r�r�r�rhs  rroz.FlagsTests.test_attributeIterconstantsIdentity|s���
����/�/�1�2�	����T�X�X�]�]�I�a�L�9����T�X�X�^�^�Y�q�\�:����T�X�X�_�_�i��l�;����T�X�X�/�/��1��>����T�X�X�]�]�I�a�L�9rc��t|jj��}t|jj��}|j|d|d�|j|d|d�|j|d|d�|j|d|d�|j|d|d�y)zw
        The constants returned from L{Flags.iterconstants} are identical on
        each call to that method.
        rrlrmrnr�N)rfr�rgr?rqs   rrsz%FlagsTests.test_iterconstantsIdentity�s���
����/�/�1�2�	��T�X�X�+�+�-�.�����U�1�X�y��|�4����U�1�X�y��|�4����U�1�X�y��|�4����U�1�X�y��|�4����U�1�X�y��|�4rc�<�|j|jd�y)zn
        L{Flags._enumerants} is initialized once and its value re-used on
        subsequent access.
        r�N)rAr�rOs rruzFlagsTests.test_initializedOnce�s��
	
�!�!�$�(�(�F�3rN)rrrr2rPrTrVr$r]rar�r�r�r!rdrjrorsrurrrr�r��sU���3�
3�3�<�2�D�2�,L�D�5�;�	�
:�5�4rr�c�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�FlagConstantSimpleOrTestsz�
    Tests for the C{|} operator as defined for L{FlagConstant} instances, used
    to create new L{FlagConstant} instances representing both of two existing
    L{FlagConstant} instances from the same L{Flags} class.
    c��|jj|jjz}|j|jjj|jjjz|j�y)z�
        The value of the L{FlagConstant} which results from C{|} has all of the
        bits set which were set in either of the values of the two original
        constants.
        N)r�r�r�r�valuer�s  r�
test_valuez$FlagConstantSimpleOrTests.test_value�sV���x�x�}�}�t�x�x�~�~�-������H�H�M�M���$�(�(�.�.�"6�"6�6��
�
�	
rc��|jj|jjz}|jd|j�y)z�
        The name of the L{FlagConstant} instance which results from C{|}
        includes the names of both of the two original constants.
        z{READ,WRITE}N)r�r�r�rrr�s  rr!z#FlagConstantSimpleOrTests.test_name�s2��
�x�x�}�}�t�x�x�~�~�-���������3rc��|jj|jjz}|jdt	|��y)z�
        The string representation of a L{FlagConstant} instance which results
        from C{|} includes the names of both of the two original constants.
        z<FXF={READ,WRITE}>N)r�r�r�rr#r�s  rr$z-FlagConstantSimpleOrTests.test_representation�s3��
�x�x�}�}�t�x�x�~�~�-�����-�t�D�z�:rc�.�|jt|jj|jjz�td��|jt|jj�t|jjf��|jt|jj|jj
z�t|jj|jj
f��y)z�
        A L{FlagConstant} instance which results from C{|} can be
        iterated upon to yield the original constants.
        rN)r�setr�r�r�r�rOs r�test_iteratez&FlagConstantSimpleOrTests.test_iterate�s���
	
��������������.�/���G�	�	
����������������!�"�	$�	
������������!3�!3�3�4����������!3�!3�4�5�	7rc��|jj|jjz}|j|jj|�|j	|jj
|�y)zj
        A L{FlagConstant} instance which results from C{|} can be
        tested for membership.
        N)r�r�r��assertIn�assertNotInr�)r�flagss  r�test_membershipz)FlagConstantSimpleOrTests.test_membership�sN��
��������!3�!3�3���
�
�d�h�h�n�n�e�,����������.rc�>�|j|jj�|j|jj|jjz�|j	|jj|jjz�y)z@
        Empty flags is false, non-empty flags is true.
        N)r&r�r�r�r'rOs r�test_truthinessz)FlagConstantSimpleOrTests.test_truthiness�s`��	
��������'������������);�);�;�<���������$�(�(�*<�*<�<�=rN)
rrrr2r�r!r$r�r�r�rrrr�r��s%���
	
�4�;�
7� /�>rr�c�"�eZdZdZd�Zd�Zd�Zy)�FlagConstantSimpleAndTestsz�
    Tests for the C{&} operator as defined for L{FlagConstant} instances, used
    to create new L{FlagConstant} instances representing the common parts of
    two existing L{FlagConstant} instances from the same L{Flags} class.
    c�6�|jj|jjz}|jj|jjz}||z}|j	|jjj
|j
�y)z�
        The value of the L{FlagConstant} which results from C{&} has all of the
        bits set which were set in both of the values of the two original
        constants.
        N�r�r�r�r�rr��r�	readWrite�writeAppendr�s    rr�z%FlagConstantSimpleAndTests.test_value�sd���X�X�]�]�T�X�X�^�^�3�	��x�x�~�~������7���;�&����������-�-�t�z�z�:rc��|jj|jjz}|jj|jjz}||z}|j	d|j
�y)z�
        The name of the L{FlagConstant} instance which results from C{&}
        includes the names of only the flags which were set in both of the two
        original constants.
        r�N�r�r�r�r�rrr�s    rr!z$FlagConstantSimpleAndTests.test_name�sV���X�X�]�]�T�X�X�^�^�3�	��x�x�~�~������7���;�&������$�)�)�,rc��|jj|jjz}|jj|jjz}||z}|j	dt|��y)z�
        The string representation of a L{FlagConstant} instance which results
        from C{&} includes the names of only the flags which were set in both
        both of the two original constants.
        z<FXF=WRITE>N�r�r�r�r�rr#r�s    rr$z.FlagConstantSimpleAndTests.test_representationsV���X�X�]�]�T�X�X�^�^�3�	��x�x�~�~������7���;�&�������T�
�3rN�rrrr2r�r!r$rrrr�r��s���
	;�	-�	4rr�c�"�eZdZdZd�Zd�Zd�Zy)�"FlagConstantSimpleExclusiveOrTestsz�
    Tests for the C{^} operator as defined for L{FlagConstant} instances, used
    to create new L{FlagConstant} instances representing the uncommon parts of
    two existing L{FlagConstant} instances from the same L{Flags} class.
    c�x�|jj|jjz}|jj|jjz}||z}|j	|jjj
|jjj
z|j
�y)z�
        The value of the L{FlagConstant} which results from C{^} has all of the
        bits set which were set in exactly one of the values of the two
        original constants.
        Nr�r�s    rr�z-FlagConstantSimpleExclusiveOrTests.test_valuesz���X�X�]�]�T�X�X�^�^�3�	��x�x�~�~������7���;�&������H�H�M�M���$�(�(�/�/�"7�"7�7����	
rc��|jj|jjz}|jj|jjz}||z}|j	d|j
�y)z�
        The name of the L{FlagConstant} instance which results from C{^}
        includes the names of only the flags which were set in exactly one of
        the two original constants.
        z
{APPEND,READ}Nr�r�s    rr!z,FlagConstantSimpleExclusiveOrTests.test_name'sV���X�X�]�]�T�X�X�^�^�3�	��x�x�~�~������7���;�&������$�)�)�4rc��|jj|jjz}|jj|jjz}||z}|j	dt|��y)z�
        The string representation of a L{FlagConstant} instance which results
        from C{^} includes the names of only the flags which were set in
        exactly one of the two original constants.
        z<FXF={APPEND,READ}>Nr�r�s    rr$z6FlagConstantSimpleExclusiveOrTests.test_representation3sW���X�X�]�]�T�X�X�^�^�3�	��x�x�~�~������7���;�&�����.��T�
�;rNr�rrrr�r�s���

�	5�	<rr�c�"�eZdZdZd�Zd�Zd�Zy)�FlagConstantNegationTestsz�
    Tests for the C{~} operator as defined for L{FlagConstant} instances, used
    to create new L{FlagConstant} instances representing all the flags from a
    L{Flags} class not set in a particular L{FlagConstant} instance.
    c���|jj}|j|jjj|jj
jz|jjjz|jjjz|j�|jj}|j|jjj|jj
jz|jjjz|jjjz|j�y)z�
        The value of the L{FlagConstant} which results from C{~} has all of the
        bits set which were not set in the original constant.
        N)r�r�rr�r�r�r�r�r�s  rr�z$FlagConstantNegationTests.test_valueFs��
���
�
�~������H�H�N�N� � ��H�H�O�O�!�!�
"��H�H���$�$�
%�
�H�H�M�M���
 �
�J�J�	������������H�H�M�M����H�H�O�O�!�!�
"��H�H���$�$�
%�
�H�H�M�M���
 �
�J�J�	rc�j�|jj}|jd|j�y)z�
        The name of the L{FlagConstant} instance which results from C{~}
        includes the names of all the flags which were not set in the original
        constant.
        z{APPEND,EXCLUSIVE,READ,TEXT}N)r�r�rrr�s  rr!z#FlagConstantNegationTests.test_name\s(������������7����Crc�h�|jj}|jdt|��y)z�
        The string representation of a L{FlagConstant} instance which results
        from C{~} includes the names of all the flags which were not set in the
        original constant.
        z"<FXF={APPEND,EXCLUSIVE,READ,TEXT}>N)r�r�rr#r�s  rr$z-FlagConstantNegationTests.test_representationfs(������������=�t�D�z�JrNr�rrrr�r�@s���
�,D�Krr�c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�OrderedConstantsTestsz�
    Tests for the ordering of constants.  All constants are ordered by
    the order in which they are defined in their container class.
    The ordering of constants that are not in the same container is not
    defined.
    c�d�|jtjtjk�y)ze
        L{constantly.NamedConstant} preserves definition
        order in C{<} comparisons.
        N�r&�NamedLetters�alpha�betarOs r�test_orderedNameConstants_ltz2OrderedConstantsTests.test_orderedNameConstants_ltxs!��
	
����*�*�\�->�->�>�?rc���|jtjtjk�|jtjtjk�y)zf
        L{constantly.NamedConstant} preserves definition
        order in C{<=} comparisons.
        NrrOs r�test_orderedNameConstants_lez2OrderedConstantsTests.test_orderedNameConstants_le�s>��
	
����*�*�l�.@�.@�@�A�����*�*�l�.?�.?�?�@rc�d�|jtjtjkD�y)ze
        L{constantly.NamedConstant} preserves definition
        order in C{>} comparisons.
        N)r&rrrrOs r�test_orderedNameConstants_gtz2OrderedConstantsTests.test_orderedNameConstants_gt�s!��
	
����)�)�L�,>�,>�>�?rc���|jtjtjk\�|jtjtjk\�y)zf
        L{constantly.NamedConstant} preserves definition
        order in C{>=} comparisons.
        NrrOs r�test_orderedNameConstants_gez2OrderedConstantsTests.test_orderedNameConstants_ge�s>��
	
����*�*�l�.@�.@�@�A�����)�)�\�-?�-?�?�@rc���|jtjtjk�|jtjtjk�y)ze
        L{constantly.ValueConstant} preserves definition
        order in C{<} comparisons.
        N�r&�
ValuedLettersr�digamma�zetarOs r�test_orderedValueConstants_ltz3OrderedConstantsTests.test_orderedValueConstants_lt�s>��
	
���
�+�+�m�.C�.C�C�D����
�-�-�
�0B�0B�B�Crc�$�|jtjtjk�|jtjtjk�|jtjtjk�y)zf
        L{constantly.ValueConstant} preserves definition
        order in C{<=} comparisons.
        NrrOs r�test_orderedValueConstants_lez3OrderedConstantsTests.test_orderedValueConstants_le�s[��
	
���
�+�+�}�/B�/B�B�C����
�+�+�}�/D�/D�D�E����
�-�-��1C�1C�C�Drc���|jtjtjkD�|jtjtjkD�y)ze
        L{constantly.ValueConstant} preserves definition
        order in C{>} comparisons.
        N)r&rrrrrOs r�test_orderedValueConstants_gtz3OrderedConstantsTests.test_orderedValueConstants_gt�s>��
	
���
�-�-�
�0C�0C�C�D����
�*�*�]�-B�-B�B�Crc�$�|jtjtjk\�|jtjtjk\�|jtjtjk\�y)zf
        L{constantly.ValueConstant} preserves definition
        order in C{>=} comparisons.
        NrrOs r�test_orderedValueConstants_gez3OrderedConstantsTests.test_orderedValueConstants_ge�s[��
	
���
�+�+�}�/B�/B�B�C����
�-�-��1D�1D�D�E����
�*�*�m�.C�.C�C�Drc���|jtjtjk�|jtjtjk�y)zd
        L{constantly.FlagConstant} preserves definition
        order in C{<} comparisons.
        N�r&�
PizzaToppings�
mozzarella�pesto�	pepperonirOs r�test_orderedFlagConstants_ltz2OrderedConstantsTests.test_orderedFlagConstants_lt�s>��
	
���
�0�0�=�3F�3F�F�G����
�+�+�m�.E�.E�E�Frc�$�|jtjtjk�|jtjtjk�|jtjtjk�y)ze
        L{constantly.FlagConstant} preserves definition
        order in C{<=} comparisons.
        NrrOs r�test_orderedFlagConstants_lez2OrderedConstantsTests.test_orderedFlagConstants_le�s[��
	
���
�0�0�M�4L�4L�L�M����
�0�0�M�4G�4G�G�H����
�+�+�}�/F�/F�F�Grc���|jtjtjkD�|jtjtjkD�y)zd
        L{constantly.FlagConstant} preserves definition
        order in C{>} comparisons.
        N)r&rrrrrOs r�test_orderedFlagConstants_gtz2OrderedConstantsTests.test_orderedFlagConstants_gt�s>��
	
���
�+�+�m�.F�.F�F�G����
�/�/�-�2E�2E�E�Frc�$�|jtjtjk\�|jtjtjk\�|jtjtjk\�y)ze
        L{constantly.FlagConstant} preserves definition
        order in C{>=} comparisons.
        NrrOs r�test_orderedFlagConstants_gez2OrderedConstantsTests.test_orderedFlagConstants_ge�s[��
	
���
�0�0�M�4L�4L�L�M����
�+�+�}�/G�/G�G�H����
�/�/�=�3F�3F�F�Grc��|jttjj	t
j��y)z�
        L{constantly._constants._Constant.__lt__} returns C{NotImplemented}
        when comparing constants of different types.
        N)�assertEquals�NotImplementedrr�__lt__rrOs r�!test_orderedDifferentConstants_ltz7OrderedConstantsTests.test_orderedDifferentConstants_lt��/��
	
�������%�%�m�&9�&9�:�	
rc��|jttjj	t
j��y)z�
        L{constantly._constants._Constant.__le__} returns C{NotImplemented}
        when comparing constants of different types.
        N)r'r(rr�__le__rrOs r�!test_orderedDifferentConstants_lez7OrderedConstantsTests.test_orderedDifferentConstants_le�r+rc��|jttjj	t
j��y)z�
        L{constantly._constants._Constant.__gt__} returns C{NotImplemented}
        when comparing constants of different types.
        N)r'r(rr�__gt__rrOs r�!test_orderedDifferentConstants_gtz7OrderedConstantsTests.test_orderedDifferentConstants_gt�r+rc��|jttjj	t
j��y)z�
        L{constantly._constants._Constant.__ge__} returns C{NotImplemented}
        when comparing constants of different types.
        N)r'r(rr�__ge__rrOs r�!test_orderedDifferentConstants_gez7OrderedConstantsTests.test_orderedDifferentConstants_ger+rc��|jttjj	t
j��y)z�
        L{constantly._constants._Constant.__lt__} returns C{NotImplemented}
        when comparing constants belonging to different containers.
        N)r'r(rrr)�MoreNamedLettersrrOs r�"test_orderedDifferentContainers_ltz8OrderedConstantsTests.test_orderedDifferentContainers_lt�0��
	
�������%�%�&6�&>�&>�?�	
rc��|jttjj	t
j��y)z�
        L{constantly._constants._Constant.__le__} returns C{NotImplemented}
        when comparing constants belonging to different containers.
        N)r'r(rrr-r6rrOs r�"test_orderedDifferentContainers_lez8OrderedConstantsTests.test_orderedDifferentContainers_ler8rc��|jttjj	t
j��y)z�
        L{constantly._constants._Constant.__gt__} returns C{NotImplemented}
        when comparing constants belonging to different containers.
        N)r'r(rrr0r6rrOs r�"test_orderedDifferentContainers_gtz8OrderedConstantsTests.test_orderedDifferentContainers_gt(r8rc��|jttjj	t
j��y)z�
        L{constantly._constants._Constant.__ge__} returns C{NotImplemented}
        when comparing constants belonging to different containers.
        N)r'r(rrr3r6rrOs r�"test_orderedDifferentContainers_gez8OrderedConstantsTests.test_orderedDifferentContainers_ge3r8rN)rrrr2rrr
rrrrrrr!r#r%r*r.r1r4r7r:r<r>rrrrrqsw���@�A�@�A�D�E�D�E�G�H�G�H�
�
�
�
�
�
�
�
rrc�,�eZdZdZe�Ze�Zy)rz
    Some letters, named.
    N)rrrr2rrrrrrrr?s���
�O�E��O�Drrc�,�eZdZdZe�Ze�Zy)r6z#
    Some more letters, named.
    N)rrrr2rrrrrrr6r6Hs����o�G��O�Drr6c�@�eZdZdZed�Zed�Zed�Zy)rz?
    Some more letters, with cooresponding unicode values.
    uΑuϜuΖN)rrrr2rrrrrrrrrQs'����I�&�E��I�&�G��I�&�Drrc�@�eZdZdZed�Zed�Zed�Zy)rzH
    Some pizza toppings, with obviously meaningful bitwise values.
    rmr�r�N)rrrr2r
rrrrrrrr_s'����f�%�J��f�%�E��f�%�IrrN)r2�
__future__rr�twisted.trial.unittestr�
constantlyrrrr	r
rr
rKr4rCr�r�r�r�r�r�r�rrr6rrrrr�<module>rFs���1�+���C7��C7�N",�6�",�Ls��/�s�n`5�(�0�`5�H�v��:e4�!�8�-A�e4�RD>� 0�(�D>�P'4�!1�8�'4�V)<�)9�8�)<�Z-K� 0�(�-K�bJ
�H�J
�\�5���u��
'�F�
'�	&�E�	&r

Zerion Mini Shell 1.0