Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_compare.cpython-312.opt-1.pyc

�

'Μg�E���dZddlZddlmZddlmZddlmZGd�dej�Z	Gd�d	ej�Z
ed
k(rej�yy)z$Test equality and order comparisons.�N)�	ALWAYS_EQ)�Fraction)�Decimalc��eZdZdZGd�d�ZGd�d�Zdddded�gZd	gd
de�gZeezZd�Z	d
�Z
d�Zd�Zd�Z
d�Zd�Zy)�ComparisonSimpleTestz:Test equality and order comparisons for some simple cases.c��eZdZd�Zy)�ComparisonSimpleTest.Emptyc��y)Nz<Empty>���selfs �./usr/local/lib/python3.12/test/test_compare.py�__repr__z#ComparisonSimpleTest.Empty.__repr__s���N)�__name__�
__module__�__qualname__rrrr�Emptyr	s��	rrc��eZdZd�Zd�Zd�Zy)�ComparisonSimpleTest.Cmpc��||_y�N��arg)r
rs  r�__init__z!ComparisonSimpleTest.Cmp.__init__s	���D�Hrc� �d|jzS)Nz<Cmp %s>rrs rrz!ComparisonSimpleTest.Cmp.__repr__s������(�(rc� �|j|k(Srr�r
�others  r�__eq__zComparisonSimpleTest.Cmp.__eq__s���8�8�u�$�$rN)rrrrrr rrr�Cmprs��	�	)�	%rr!�g@y@�)�Nc���|jD]X}|jD]G}||jvr||jvs||ur|j||��6|j||��I�Zyr)�
candidates�set1�assertEqual�assertNotEqual�r
�a�bs   r�test_comparisonsz%ComparisonSimpleTest.test_comparisonssY�����A��_�_���$�)�)�^�!�t�y�y�.�a�1�f��$�$�Q��*��'�'��1�-�	%�!rc
���g}td�D].}|jt|�dz|j���0|D]'}|D] }|j	||k(||ud|�d|����"�)y)N�
r"za=z, b=)�range�insert�lenrr()r
�L�ir+r,s     r�test_id_comparisonsz(ComparisonSimpleTest.test_id_comparisons%sd�����r��A�
�H�H�S��V�Q�Y��
�
��-���A���� � ��a���a���A�1F�G��rc���|jd�}|jd�}|jd�}|j||k(d�|j||k7d�|j||k7d�y)Nr#r"TF)r!�assertIs)r
r+r,�cs    r�test_ne_defaults_to_not_eqz/ComparisonSimpleTest.test_ne_defaults_to_not_eq.s_���H�H�Q�K���H�H�Q�K���H�H�Q�K���
�
�a�1�f�d�#��
�
�a�1�f�e�$��
�
�a�1�f�d�#rc���g�G�fd�d�}G�fd�d�}|�|�k7|j�ddg�y)z;object.__ne__() should allow reflected __ne__() to be triedc���eZdZ�fd�Zy)�8ComparisonSimpleTest.test_ne_high_priority.<locals>.Leftc�2���jd�tS)N�Left.__eq__��append�NotImplemented��args�callss �rr z?ComparisonSimpleTest.test_ne_high_priority.<locals>.Left.__eq__;�������]�+�%�%rN�rrrr �rDs�r�Leftr<9����
&rrHc�"��eZdZ�fd�Z�fd�Zy)�9ComparisonSimpleTest.test_ne_high_priority.<locals>.Rightc�2���jd�tS)NzRight.__eq__r?rBs �rr z@ComparisonSimpleTest.test_ne_high_priority.<locals>.Right.__eq__?�������^�,�%�%rc�2���jd�tS)N�Right.__ne__r?rBs �r�__ne__z@ComparisonSimpleTest.test_ne_high_priority.<locals>.Right.__ne__BrMrN�rrrr rPrGs�r�RightrK>�
���
&�
&rrRr>rON��assertSequenceEqual)r
rHrRrDs   @r�test_ne_high_priorityz*ComparisonSimpleTest.test_ne_high_priority6s?�����	&�	&�
	&�	&�	
��%�'��� � ����(G�Hrc���g�G�fd�d�}G�fd�d|�}|�|�k7|j�ddg�y)z4object.__ne__() should not invoke reflected __eq__()c���eZdZ�fd�Zy)�7ComparisonSimpleTest.test_ne_low_priority.<locals>.Basec�2���jd�tS)N�Base.__eq__r?rBs �rr z>ComparisonSimpleTest.test_ne_low_priority.<locals>.Base.__eq__MrErNrFrGs�r�BaserYKrIrr\c�"��eZdZ�fd�Z�fd�Zy)�:ComparisonSimpleTest.test_ne_low_priority.<locals>.Derivedc�2���jd�tS)NzDerived.__eq__r?rBs �rr zAComparisonSimpleTest.test_ne_low_priority.<locals>.Derived.__eq__Q�������-�.�%�%rc�2���jd�tS)N�Derived.__ne__r?rBs �rrPzAComparisonSimpleTest.test_ne_low_priority.<locals>.Derived.__ne__Tr`rNrQrGs�r�Derivedr^PrSrrcrbr[NrT)r
r\rcrDs   @r�test_ne_low_priorityz)ComparisonSimpleTest.test_ne_low_priorityHsB�����	&�	&�
	&�d�	&�	
��'�)��� � ��)9�=�(I�Jrc	����dd�fdd�fdd�fdd�fd	d
�ff}|D]�\}}�j|�5�fd��G�fd�d
�}|D]\}}||k7s�t||���|dk(r'�j||�t��d�n%�j	t
||�t��ddd���y#1swY��xYw)z8No default delegation between operations except __ne__()r c��||k(Srr�r+r,s  r�<lambda>z<ComparisonSimpleTest.test_other_delegation.<locals>.<lambda>]���A��Fr�__lt__c��||kSrrrgs  rrhz<ComparisonSimpleTest.test_other_delegation.<locals>.<lambda>^���A��Er�__le__c��||kSrrrgs  rrhz<ComparisonSimpleTest.test_other_delegation.<locals>.<lambda>_rir�__gt__c��||kDSrrrgs  rrhz<ComparisonSimpleTest.test_other_delegation.<locals>.<lambda>`rlr�__ge__c��||k\Srrrgs  rrhz<ComparisonSimpleTest.test_other_delegation.<locals>.<lambda>arirc�(���jd�y)Nz!Unexpected operator method called)�fail)rCr
s �r�
unexpectedz>ComparisonSimpleTest.test_other_delegation.<locals>.unexpectedes����I�I�A�Brc���eZdZW�Zy)�5ComparisonSimpleTest.test_other_delegation.<locals>.CN)rrrrP)rus�r�Crwgs���'�FrrxFN)�subTest�setattrr7�object�assertRaises�	TypeError)r
�ops�name�funcrxr�_rus`      @r�test_other_delegationz*ComparisonSimpleTest.test_other_delegationZs�����*�+�
�)�*�
�*�+�
�)�*�
�*�+�
���J�D�$����d�#�C�(�(� #�H�E�1���}���5�*�5�!$��8�#��M�M�$�q�s�F�H�"5�u�=��%�%�i��q�s�F�H�E�$�#��#�#�s�B=�A B=�=C	c���d�}|j|t�|jt|�t�}|j|t�|jt|�y)Nc��yrrrrrrhz6ComparisonSimpleTest.test_issue_1393.<locals>.<lambda>rs��Dr)r(rr{)r
�x�ys   r�test_issue_1393z$ComparisonSimpleTest.test_issue_1393qsN��������I�&�����A�&��H������I�&�����A�&r)rrr�__doc__rr!r'�set2r&r-r5r9rVrdr�r�rrrrrsq��D���%�%�
�s�A�t�S��X�&�D�
�C��t�U�W�%�D����J�.�H�$�I�$K�$F�.'rrc
��eZdZdZGd�d�ZGd�de�ZGd�de�ZGd�d	e�ZGd
�de�ZGd�d
e�Z	Gd�de�Z
Gd�de�ZGd�de�ZGd�de�Z
Gd�de�Zeeeee	e
eee
ef
Zd�Zd�Zd+d�Zd�Zd�Zd�Zd�Zd �Zd!�Zd"�Zd#�Zd$�Zd%�Zd&�Zd'�Zd(�Zd)�Z d*�Z!y),�ComparisonFullTestz�Test equality and ordering comparisons for built-in types and
    user-defined classes that implement relevant combinations of rich
    comparison methods.
    c��eZdZdZy)�ComparisonFullTest.CompBaseaBase class for classes with rich comparison methods.

        The "x" attribute should be set to an underlying value to compare.

        Derived classes have a "meth" tuple attribute listing names of
        comparison methods implemented. See assert_total_order().
        N)rrrr�rrr�CompBaser��s��	rr�c��eZdZdZy)�ComparisonFullTest.CompNonerN)rrr�methrrr�CompNoner��s���rr�c��eZdZdZd�Zy)�ComparisonFullTest.CompEq)�eqc�4�|j|jk(Sr�r�rs  rr z ComparisonFullTest.CompEq.__eq__�����6�6�U�W�W�$�$rN)rrrr�r rrr�CompEqr�������	%rr�c��eZdZdZd�Zy)�ComparisonFullTest.CompNe)�nec�4�|j|jk7Srr�rs  rrPz ComparisonFullTest.CompNe.__ne__�r�rN)rrrr�rPrrr�CompNer��r�rr�c��eZdZdZd�Zd�Zy)�ComparisonFullTest.CompEqNe)r�r�c�4�|j|jk(Srr�rs  rr z"ComparisonFullTest.CompEqNe.__eq__�r�rc�4�|j|jk7Srr�rs  rrPz"ComparisonFullTest.CompEqNe.__ne__�r�rN)rrrr�r rPrrr�CompEqNer�������	%�	%rr�c��eZdZdZd�Zy)�ComparisonFullTest.CompLt)�ltc�4�|j|jkSrr�rs  rrjz ComparisonFullTest.CompLt.__lt__�����6�6�E�G�G�#�#rN)rrrr�rjrrr�CompLtr�������	$rr�c��eZdZdZd�Zy)�ComparisonFullTest.CompGt)�gtc�4�|j|jkDSrr�rs  rroz ComparisonFullTest.CompGt.__gt__�r�rN)rrrr�rorrr�CompGtr��r�rr�c��eZdZdZd�Zd�Zy)�ComparisonFullTest.CompLtGt)r�r�c�4�|j|jkSrr�rs  rrjz"ComparisonFullTest.CompLtGt.__lt__�r�rc�4�|j|jkDSrr�rs  rroz"ComparisonFullTest.CompLtGt.__gt__�r�rN)rrrr�rjrorrr�CompLtGtr��s����	$�	$rr�c��eZdZdZd�Zy)�ComparisonFullTest.CompLe)�lec�4�|j|jkSrr�rs  rrmz ComparisonFullTest.CompLe.__le__�r�rN)rrrr�rmrrr�CompLer��r�rr�c��eZdZdZd�Zy)�ComparisonFullTest.CompGe)�gec�4�|j|jk\Srr�rs  rrqz ComparisonFullTest.CompGe.__ge__�r�rN)rrrr�rqrrr�CompGer��r�rr�c��eZdZdZd�Zd�Zy)�ComparisonFullTest.CompLeGe)r�r�c�4�|j|jkSrr�rs  rrmz"ComparisonFullTest.CompLeGe.__le__�r�rc�4�|j|jk\Srr�rs  rrqz"ComparisonFullTest.CompLeGe.__ge__�r�rN)rrrr�rmrqrrr�CompLeGer��r�rr�c��tt|��D�cgc]	}|���}}|jt��t	||�D]\}}||_�|Scc}w)a�Create objects of type `class_` and return them in a list.

        `values` is a list of values that determines the value of data
        attribute `x` of each object.

        Objects in the returned list are sorted by their identity.  They
        assigned values in `values` list order.  By assign decreasing
        values to objects with increasing identities, testcases can assert
        that order comparison is performed by value and not by identity.
        )�key)r0r2�sort�id�zipr�)r
�class_�values�__�	instances�inst�values       r�create_sorted_instancesz*ComparisonFullTest.create_sorted_instances�sZ��).�c�&�k�(:�;�(:�"�V�X�(:�	�;����2����y�&�1�K�D�%��D�F�2����<s�Ac��|j||k(|�|j||k(|�|j||k7|�|j||k7|�|jtd�5||kddd�|jtd�5||kddd�|jtd�5||kDddd�|jtd�5||k\ddd�|jtd�5||kddd�|jtd�5||kddd�|jtd�5||kDddd�|jtd�5||k\ddd�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY�wxYw#1swYyxYw)z�Assert equality result and that ordering is not implemented.

        a, b: Instances to be tested (of same or different type).
        equal: Boolean indicating the expected equality comparison results.
        �
not supportedN�r(�assertRaisesRegexr})r
r+r,�equals    r�assert_equality_onlyz'ComparisonFullTest.assert_equality_only�s~��	
����a���'�����a���'�����a��U��+�����a��U��+�
�
#�
#�I��
?�
��E�@�
�
#�
#�I��
?�
��F�@�
�
#�
#�I��
?�
��E�@�
�
#�
#�I��
?�
��F�@�
�
#�
#�I��
?�
��E�@�
�
#�
#�I��
?�
��F�@�
�
#�
#�I��
?�
��E�@�
�
#�
#�I��
?�
��F�@�
?�@�
?��
?�
?��
?�
?��
?�
?��
?�
?��
?�
?��
?�
?��
?�
?�s`�-E8�F�5F�F�=F)�!F5�G�)G
�8F�F�F�F&�)F2�5F>�G
�
GNc��|j|||||�|j|||||�|j|||||�|j|||||�|j	|||||�|j|||||�y)aFTest total ordering comparison of two instances.

        a, b: Instances to be tested (of same or different type).

        comp: -1, 0, or 1 indicates that the expected order comparison
           result for operations that are supported by the classes is
           a <, ==, or > b.

        a_meth, b_meth: Either None, indicating that all rich comparison
           methods are available, aa for builtins, or the tuple (subset)
           of "eq", "ne", "lt", "le", "gt", and "ge" that are available
           for the corresponding instance (of a user-defined class).
        N)�assert_eq_subtest�assert_ne_subtest�assert_lt_subtest�assert_le_subtest�assert_gt_subtest�assert_ge_subtest�r
r+r,�comp�a_meth�b_meths      r�assert_total_orderz%ComparisonFullTest.assert_total_order�s���	
���q�!�T�6�6�:����q�!�T�6�6�:����q�!�T�6�6�:����q�!�T�6�6�:����q�!�T�6�6�:����q�!�T�6�6�:rc���|�d|vsd|vr1|j||k(|dk(�|j||k(|dk(�y|j||k(||u�|j||k(||u�y)Nr�r)r(r�s      rr�z$ComparisonFullTest.assert_eq_subtestss���>�T�V�^�t�v�~����Q�!�V�T�Q�Y�/����Q�!�V�T�Q�Y�/����Q�!�V�Q�!�V�,����Q�!�V�Q�!�V�,rc���|�ddhj||z�s1|j||k7|dk7�|j||k7|dk7�y|j||k7||u�|j||k7||u�y)Nr�r�r)�
isdisjointr(r�s      rr�z$ComparisonFullTest.assert_ne_subtests|���>�$���!8�!8��&��!I����Q�!�V�T�Q�Y�/����Q�!�V�T�Q�Y�/����Q�!�V�Q�a�Z�0����Q�!�V�Q�a�Z�0rc�:�|�d|vsd|vr1|j||k|dk�|j||kD|dk�y|jtd�5||kddd�|jtd�5||kDddd�y#1swY�.xYw#1swYyxYw)Nr�r�rr�r�r�s      rr�z$ComparisonFullTest.assert_lt_subtest'����>�T�V�^�t�v�~����Q��U�D�1�H�-����Q��U�D�1�H�-��'�'�	�?�C��A��D��'�'�	�?�C��A��D�C�D�C��C�C���B�6B�B�Bc�:�|�d|vsd|vr1|j||k|dk�|j||k\|dk�y|jtd�5||kddd�|jtd�5||k\ddd�y#1swY�.xYw#1swYyxYw)Nr�r�rr�r�r�s      rr�z$ComparisonFullTest.assert_le_subtest1����>�T�V�^�t�v�~����Q�!�V�T�Q�Y�/����Q�!�V�T�Q�Y�/��'�'�	�?�C��Q��D��'�'�	�?�C��Q��D�C�D�C��C�C�r�c�:�|�d|vsd|vr1|j||kD|dkD�|j||k|dkD�y|jtd�5||kDddd�|jtd�5||kddd�y#1swY�.xYw#1swYyxYw)Nr�r�rr�r�r�s      rr�z$ComparisonFullTest.assert_gt_subtest;r�r�c�:�|�d|vsd|vr1|j||k\|dk\�|j||k|dk\�y|jtd�5||k\ddd�|jtd�5||kddd�y#1swY�.xYw#1swYyxYw)Nr�r�rr�r�r�s      rr�z$ComparisonFullTest.assert_ge_subtestEr�r�c�x�t�}t�}|j||d�|j||d�y)z#Compare instances of type 'object'.TFN)r{r�r*s   r�test_objectszComparisonFullTest.test_objectsOs4���H���H���!�!�!�Q��-��!�!�!�Q��.rc	��|jD]�}|j|�5|j|d�}|j|d|dd|j|j�|j|d|dd|j|j�|j|d|dd|j|j�|j|d|dd|j|j�ddd���y#1swY��xYw)z5Compare same-class instances with comparison methods.)r#r"r#rr"r#���N)�all_comp_classesryr�r�r�)r
�clsr�s   r�test_comp_classes_samez)ComparisonFullTest.test_comp_classes_sameVs����(�(�C����c�"� �8�8��i�H�	��'�'�	�!��i��l�A�(+���#�(�(�<��'�'�	�!��i��l�A�(+���#�(�(�<��'�'�	�!��i��l�B�(+���#�(�(�<��'�'�	�!��i��l�B�(+���#�(�(�<�%#�"�)�"�"�s�CC;�;D	c
��|jD]�}|jD]�}|j||��5|�}d|_|�}d|_|�}d|_|j||d|j|j�|j||d|j|j�ddd�����y#1swY��xYw)z:Compare different-class instances with comparison methods.rgr#r"rr�N)r�ryr�r�r�)r
�cls_a�cls_b�a1�b1�b2s      r�test_comp_classes_differentz.ComparisonFullTest.test_comp_classes_differentos����*�*�E��.�.���\�\�E�U�\�3���B��B�D���B��B�D���B��B�D��+�+��B��5�:�:�u�z�z�;��+�+��B��E�J�J��
�
�<�4�3�/�+�3�3�s�A=B<�<Cc���Gd�dt�}td�}td�}|d�}|d�}|d�}|j||d�|j||d�|j||d�|j||d�|j||d�|j||d�|j||d�|j||d�|j||d�y)z(Compare instances of str and a subclass.c��eZdZy)�9ComparisonFullTest.test_str_subclass.<locals>.StrSubclassN)rrrrrr�StrSubclassr��s��rr�r+r,rr�N)�strr�)r
r��s1�s2�c1�c2�c3s       r�test_str_subclassz$ComparisonFullTest.test_str_subclass�s���	�#�	���X��
��X��
��
��
��
��
��
������B�!�,�����B��+�����B�!�,�����B��+�����B�!�,�����B��+�����B�!�,�����B��+�����B�!�,rc��d}d}|j||d�|j||d�d}d}|j||d�|j||d�tdd�}td	d�}|j||d�|j||d�td
�}td�}|j||d�|j||d�d}	d
}
|j|	|	d�|j|	|
d�||f||f||f||f||f||ffD]\}}|j||d��||||fD]}|j||	d��y)zCompare number types.i�i�rr�gH�@g�����H�@i�r"i�z1001.0z1001.1yH�@yH�@�?TFN)r�rrr�)
r
�i1�i2�f1�f2�q1�q2�d1�d2rr�n1�n2s
             r�test_numberszComparisonFullTest.test_numbers�so����
������B��*�����B��+�
��
������B��*�����B��+�
�d�A�
��
�d�A�
������B��*�����B��+�
�X�
��
�X�
������B��*�����B��+�
��
���!�!�"�b�$�/��!�!�"�b�%�0��2�w��B��"�R��2�b�'�B�r�7�R��G�L�F�B���#�#�B��A�.�M��r�2�r�"�B��%�%�b�"�d�3�#rc��ddg}ddg}|j||d�|j||d�d}d}|j||d�|j||d�tdd�}tdd�}|j||d�|j||d	�|j||d	�|j||d	�|j||d	�y
)zCompare list, tuple, and range.r#r"r$rr��r#r"�r"r$TFN)r�r0r�)r
�l1�l2�t1�t2�r1�r2s       r�test_sequencesz!ComparisonFullTest.test_sequences�s�����V����V������B��*�����B��+�
��
������B��*�����B��+�
�1�a�[��
�1�a�[���!�!�"�b�$�/��!�!�"�b�%�0��!�!�"�b�%�0��!�!�"�b�%�0��!�!�"�b�%�0rc�h�d}d}|j||d�|j||d�td�}td�}|j||d�|j||d�|j||d�|j||d�|j||d�|j||d�y)zCompare bytes and bytearray.sa1sb2rr�N)r��	bytearray)r
�bs1�bs2�ba1�ba2s     r�
test_byteszComparisonFullTest.test_bytes�s�����������S�!�,�����S�"�-�������������S�1�-�����S�"�-�����S�!�,�����S�"�-�����S�!�,�����S�"�-rc�p�ddh}hd�}|j||d�|j||d�t|�}t|�}|j||d�|j||d�|j||d�|j||d�|j||d�|j||d�y)zCompare set and frozenset.r#r">r#r"r$rr�N)r��	frozenset)r
rrr
rs     r�	test_setszComparisonFullTest.test_sets�s�����V��
������B��*�����B��+�
�r�]��
�r�]������B��+�����B��+�����B��*�����B��+�����B��*�����B��+rc��ddd�}ddd�}ddd�}|j||d�|j||d�|j||d�y	)
z Compare dict.
        r+r,rr8r)r$r"TFN)r�)r
rr�d3s    r�
test_mappingsz ComparisonFullTest.test_mappings�sX����
����
����
���!�!�"�b�$�/��!�!�"�b�%�0��!�!�"�b�$�/r)NN)"rrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr#r&r)rrrr�r�zs���
���8��%��%�
%��%�
%�8�%�$��$�
$��$�
$�8�$�%��%�
%��%�
%�8�%�
��F�H��F�H��F�H�	&���&�6;�8-�1�����/�<�2<�$-�,"4�H1�*.�",�"0rr��__main__)
r��unittest�test.supportr�	fractionsr�decimalr�TestCaserr�r�mainrrr�<module>r1sX��*��"���o'�8�,�,�o'�d@0��*�*�@0�F�z���H�M�M�O�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists