HEX
Server: Apache
System: Linux bd12.noc223.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: handcraf (1693)
PHP: 8.1.28
Disabled: NONE
Upload Files
File: //opt/alt/python312/lib64/python3.12/test/test_capi/__pycache__/test_long.cpython-312.opt-2.pyc
�

}h�eoE����ddlZddlZddlmZejd�ZdZGd�de�ZGd�d�Z	Gd�d	�Z
Gd
�dej�Ze
dk(rej�yy)
�N)�
import_helper�	_testcapic��eZdZy)�IntSubclassN)�__name__�
__module__�__qualname__���?/opt/alt/python312/lib64/python3.12/test/test_capi/test_long.pyrrs��rrc��eZdZd�Zd�Zy)�Indexc��||_y�N��value)�selfrs  r�__init__zIndex.__init__s	����
rc��|jSrr�rs r�	__index__zIndex.__index__s���z�z�rN)rrr	rrr
rrrrs���rrc��eZdZd�Zd�Zy)�
MyIndexAndIntc��y)N�
r
rs rrzMyIndexAndInt.__index__���rc��y)N�r
rs r�__int__zMyIndexAndInt.__int__rrN)rrr	rrr
rrrrs���rrc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�	LongTestsc��hd�td�D��d�td�D��d�td�D��d�td�D��d�td�D��d�td�D��D]I}|j|�	�5tj|�\}}|r|j	||�ddd��Ky#1swY�VxYw)
Nc3�&K�|]	}d|z���y�w��Nr
��.0�ns  r�	<genexpr>z)LongTests.test_compact.<locals>.<genexpr>"s����
&�q�a��d�
&����Bc3�(K�|]
}d|z���y�wr$r
r&s  rr)z)LongTests.test_compact.<locals>.<genexpr>#s����
'��q�!�t�e�
'���c3�,K�|]}d|zdz
���y�w�r%�Nr
r&s  rr)z)LongTests.test_compact.<locals>.<genexpr>$s����
*�1�a��d�Q�h�
*�s�c3�.K�|]
}d|zdz���y�wr/r
r&s  rr)z)LongTests.test_compact.<locals>.<genexpr>%s����
+�A�q�!�t�e�a�i�
+�s�c3�&K�|]	}d|z���y�w��%Nr
r&s  rr)z)LongTests.test_compact.<locals>.<genexpr>'s����
'��b�!�e�
'�r*�c3�(K�|]
}d|z���y�wr3r
r&s  rr)z)LongTests.test_compact.<locals>.<genexpr>(s����
(��r�1�u�f�
(�r-)r()�range�subTestr�call_long_compact_api�assertEqual)rr(�
is_compactrs    r�test_compactzLongTests.test_compacts���	
�
&�E�"�I�
&�	
�(�U�2�Y�
'�	
�+��b�	�
*�		
�
,��r��
+�	
�(�U�2�Y�
'�	
�)�e�B�i�
(�	
�
	/�A������"�
/�$-�$C�$C�A�$F�!�
�E���$�$�Q��.�
/�
/�
	/�
/�
/�s�-B<�<C	c�H�|jtjd�d�|jtjd�d�|jtjd�d�|jtjtj�d�y)N���)Tr>r)Tr�)Tr?)Fr>)r:rr9�sys�maxsizers r�test_compact_knownzLongTests.test_compact_known/sw��	
����8�8��<�j�I�����8�8��;�Y�G�����8�8��=�{�K�����8�8����E�$�	&rc��tj}|j|d��|j|d��|j|d��|j|d��|j|td���|j	|d��|j	|t���y�Nr0l�
~��l!]cr>T��?)r�pylong_check�
assertTruer�assertFalse�object�r�checks  r�test_long_checkzLongTests.test_long_check8s����&�&������a��!�����<�=�>�����b�	�"�����d��$�����k�!�n�-�.�����s��$�����v�x��)rc��tj}|j|d��|j|d��|j|d��|j|d��|j|t	d���|j|d��|j|t���yrD)r�pylong_checkexactrGrHrrIrJs  r�test_long_checkexactzLongTests.test_long_checkexactDs����+�+������a��!�����<�=�>�����b�	�"�����t��%�����{�1�~�.�/�����s��$�����v�x��)rc	���tj}tjj}ddddddd||f	D]>}|j|��5|j
||�t|��ddd��@|jt|td	��|jt|td
��|jt|td��y#1swY��xYw)Ng@gffffff@g������@gffffff�g�������gg�r�infz-inf�nan)r�pylong_fromdoubler@�
float_info�maxr8r:�int�assertRaises�
OverflowError�float�
ValueError)r�
fromdouble�	float_maxrs    r�test_long_fromdoublezLongTests.test_long_fromdoublePs����0�0�
��N�N�&�&�	��3��T�4��d�I�	�z�R�	@�E����E��*�
@�� � ��E�!2�C��J�?�
@�
@�	@�	
���-��U�5�\�B����-��U�6�]�C����*�j�%��,�?�	
@�
@�s�"C�C"	c�$�tj}t�}||�}|t�}|j	|t
�|j
|d�|j	|t
�|j|d�|j||�y)Nr)	r�pylong_fromvoidptrrI�NULL�assertIsInstancerV�assertGreaterEqualr:�assertNotEqual)r�fromvoidptr�obj�x�ys     r�test_long_fromvoidptrzLongTests.test_long_fromvoidptr[sx���2�2���h�������������a��%�����1�%����a��%�����A�����A�q�!rc�4�tj}|j|dd�d�|j|dd�d�|j|dd�d	�|j|dd
�d�|j|dd
�d�|jt|dd
�|j|d
d�d�|j|dd�d�|j|dd�d�|jt|dd�|jt|dd�|jt|dd�|jt|dd�|jt|dd�|jt|dj�d
�|jt|dj�d�|j|dd
�d�|j|dd
�d�|j|dd�d�|j|dd�d�y)Ns123r)�{�scafe�)���sxyz�$)�rkrs0xcafe)rm�s-123)���rns -123 )rrrqs1_23)rjrns- 123rr0r>r4�١٢٣٤٥٦٧٨٩٠s123s123456)i#rk)r�pylong_fromstringr:rWrZ�encode)r�
fromstrings  r�test_long_fromstringzLongTests.test_long_fromstringgs����0�0�
�����F�B�/��:�����G�R�0�+�>�����F�B�/��<�����F�A�.��9�����I�q�1�;�?����*�j�'�1�=�����G�R�0�)�<�����I�r�2�I�>�����G�R�0�(�;����*�j�(�B�?����*�j�#�r�:����*�j�&�!�<����*�j�&�"�=����*�j�&�"�=����*�j�2H�2O�2O�2Q�ST�U����*�j�2H�2O�2O�2Q�SU�V�����J��2�H�=�����M�1�5�x�@�����J��3�Z�@�����M�2�6�
�Crc��tj}|j|dd�d�|j|dd�d�|j|dd�d	�|j|dd
�d�|j|dd
�d�|jt|dd
�|j|dd�d
�|j|dd�d
�|j|dd�d�|jt|dd�|jt|dd�|jt|dd�|jt|dd�|jt|dd�|j|dd
�d�|j|dd�d�|jt|dd
�|jt|dd
�|jt|dd�|jt|dd�y)N�123rrj�caferlrm�xyzrorpr�0xcafez-123rrz -123 �1_23z- 123�r0r>r4rsi��Il�x�hHz123z123456)r�pylong_fromunicodeobjectr:rWrZ)r�fromunicodeobjects  r�test_long_fromunicodeobjectz%LongTests.test_long_fromunicodeobject�s���%�>�>�����*�5�"�5�s�;����*�6�2�6��?����*�5�"�5�u�=����*�5�!�4�c�:����*�8�Q�7��@����*�&7���C����*�6�2�6��=����*�8�R�8�$�?����*�6�2�6��<����*�&7��"�E����*�&7��R�@����*�&7���B����*�&7���C����*�&7���C����*�+A�1�E�z�R����*�+A�2�F��U����*�&7��A�F����*�&7��q�I����*�&7��B�G����*�&7��r�Jrc��tj}ddlm}m}||ddddfD]5}|j	|��5|j||�|�ddd��7|j|t
d��d�|j|td��d�|j|t��d�|jt||dz
�|jt||dz�|jt|d	�|jt|d
�|jt|d�|jt|t�y#1swY��9xYw)Nr��LONG_MIN�LONG_MAXr>r0��r�*rrE�2�3)r�
pylong_aslongr�r�r8r:rrrrWrX�	TypeError�SystemErrorr`)r�aslongr�r�rs     r�test_long_aslongzLongTests.test_long_aslong�s'���(�(��0���"�a��D�9�	7�E����E��*�
7�� � �����6�
7�
7�	7�	
�����B��0�"�5������b�	�*�B�/�����
��0�"�5����-���A��>����-���A��>����)�V�S�1����)�V�T�2����)�V�S�1����+�v�t�4�
7�
7���E�E	c��tj}ddlm}m}||ddddfD]7}|j	|��5|j||�|df�ddd��9|j|t
d��d�|j|td��d�|j|t��d	�|j||dz
�d
�|j||dz�d�y#1swY��xYw)Nrr�r>r0r�rr��r�r�rr�r>r>�r>r0)	r�pylong_aslongandoverflowr�r�r8r:rrr)r�aslongandoverflowr�r�rs     r�test_long_aslongandoverflowz%LongTests.test_long_aslongandoverflow�s���%�>�>��0���"�a��D�9�	G�E����E��*�
G�� � �!2�5�!9�E�1�:�F�
G�
G�	G�	
���*�;�r�?�;�W�E����*�5��9�5�w�?����*�=�?�;�W�E����*�8�a�<�8�(�C����*�8�a�<�8�'�B�
G�
G���C4�4C=	c��tj}ddlm}|dddfD]5}|j|��5|j	||�|�ddd��7|j	|td��d�|j
t|td��|j
t|t��|j
t|d�|j
t||dz�|j
t|d�|j
t|d	�|j
t|d
�|j
t|t�y#1swY��4xYw)Nr��	ULONG_MAXr0r�rr�r>rEr�r�)
r�pylong_asunsignedlongr�r8r:rrWr�rrrXr�r`)r�asunsignedlongr�rs    r�test_long_asunsignedlongz"LongTests.test_long_asunsignedlong�s��"�8�8��'���A�t�,�	?�E����E��*�
?�� � ���!6��>�
?�
?�	?�	
�����B��8�"�=����)�^�U�2�Y�?����)�^�]�_�E����-���<����-���Q��G����)�^�S�9����)�^�T�:����)�^�S�9����+�~�t�<�
?�
?���E�E	c��tj}ddlm}|dddfD]5}|j|��5|j	||�|�ddd��7|j	|td��d�|j	|t
d��d�|j	|t��d�|j	|d�|�|j	||dz�d�|jt|d	�|jt|d
�|jt|d�|jt|t�y#1swY��8xYw)Nrr�r0r�rr�rr>rEr�r�)r�pylong_asunsignedlongmaskr�r8r:rrrrWr�r�r`)r�asunsignedlongmaskr�rs    r�test_long_asunsignedlongmaskz&LongTests.test_long_asunsignedlongmask�s8��&�@�@��'���A�t�,�	C�E����E��*�
C�� � �!3�E�!:�E�B�
C�
C�	C�	
���+�K��O�<�b�A����+�E�"�I�6��;����+�M�O�<�b�A����+�B�/��;����+�I��M�:�A�>����)�%7��=����)�%7��>����)�%7��=����+�'9�4�@�
C�
C���E�E	c��tj}ddlm}m}||ddddfD]5}|j	|��5|j||�|�ddd��7|j|t
d��d�|j|td��d�|j|t��d�|jt||dz
�|jt||dz�|jt|d	�|jt|d
�|jt|d�|jt|t�y#1swY��9xYw)Nr��	LLONG_MIN�	LLONG_MAXr>r0r�rr�rrEr�r�)r�pylong_aslonglongr�r�r8r:rrrrWrXr�r�r`)r�
aslonglongr�r�rs     r�test_long_aslonglongzLongTests.test_long_aslonglong�s(���0�0�
�2���B��1�d�;�	;�E����E��*�
;�� � ��E�!2�E�:�
;�
;�	;�	
����K��O�4�b�9�����E�"�I�.��3�����M�O�4�b�9����-��Y��]�C����-��Y��]�C����)�Z��5����)�Z��6����)�Z��5����+�z�4�8�
;�
;�r�c��tj}ddlm}m}||ddddfD]7}|j	|��5|j||�|df�ddd��9|j|t
d��d�|j|td��d�|j|t��d	�|j||dz
�d
�|j||dz�d�y#1swY��xYw)Nrr�r>r0r�rr�r�r�r�r�)	r�pylong_aslonglongandoverflowr�r�r8r:rrr)r�aslonglongandoverflowr�r�rs     r�test_long_aslonglongandoverflowz)LongTests.test_long_aslonglongandoverflows��� )� F� F��2���B��1�d�;�	K�E����E��*�
K�� � �!6�u�!=��q�z�J�
K�
K�	K�	
���.�{�2��?��I����.�u�R�y�9�7�C����.�}��?��I����.�y�1�}�=�x�H����.�y�1�}�=�w�G�
K�
K�r�c��tj}ddlm}|dddfD]5}|j|��5|j	||�|�ddd��7|j	|td��d�|j
t|td��|j
t|t��|j
t|d�|j
t||dz�|j
t|d�|j
t|d	�|j
t|d
�|j
t|t�y#1swY��4xYw)Nr��
ULLONG_MAXr0r�rr�r>rEr�r�)
r�pylong_asunsignedlonglongr�r8r:rrWr�rrrXr�r`)r�asunsignedlonglongr�rs    r�test_long_asunsignedlonglongz&LongTests.test_long_asunsignedlonglongs,��&�@�@��(� �!�Q��-�	C�E����E��*�
C�� � �!3�E�!:�E�B�
C�
C�	C�	
���+�K��O�<�b�A����)�%7��r��C����)�%7���I����-�);�R�@����-�);�Z�!�^�L����)�%7��=����)�%7��>����)�%7��=����+�'9�4�@�
C�
C�r�c��tj}ddlm}|dddfD]5}|j|��5|j	||�|�ddd��7|j	|td��d�|j	|t
d��d�|j	|t��d�|j	|d�|�|j	||dz�d�|jt|d	�|jt|d
�|jt|d�|jt|t�y#1swY��8xYw)Nrr�r0r�rr�rr>rEr�r�)r�pylong_asunsignedlonglongmaskr�r8r:rrrrWr�r�r`)r�asunsignedlonglongmaskr�rs    r� test_long_asunsignedlonglongmaskz*LongTests.test_long_asunsignedlonglongmask+s8��!*�!H�!H��(� �!�Q��-�	G�E����E��*�
G�� � �!7��!>��F�
G�
G�	G�	
���/��B��@�"�E����/��b�	�:�B�?����/�
��@�"�E����/��3�Z�@����/�
�Q��?��C����)�%;�S�A����)�%;�T�B����)�%;�S�A����+�'=�t�D�
G�
G�r�c��tj}ddlm}m}||ddddfD]5}|j	|��5|j||�|�ddd��7|j|t
d��d�|jt|td��|jt|t��|jt||dz
�|jt||dz�|jt|d�|jt|d	�|jt|d
�|jt|t�y#1swY��7xYw)Nr)�PY_SSIZE_T_MIN�PY_SSIZE_T_MAXr>r0r�rr�rEr�r�)r�pylong_as_ssize_tr�r�r8r:rrWr�rrrXr�r`)r�
as_ssize_tr�r�rs     r�test_long_as_ssize_tzLongTests.test_long_as_ssize_t?s$���0�0�
�<�$�n�b�!�Q��E�	;�E����E��*�
;�� � ��E�!2�E�:�
;�
;�	;�	
����K��O�4�b�9����)�Z��r��;����)�Z���A����-��^�a�5G�H����-��^�a�5G�H����)�Z��5����)�Z��6����)�Z��5����+�z�4�8�
;�
;�s�E�E	c��tj}ddlm}|dddfD]5}|j|��5|j	||�|�ddd��7|j	|td��d�|j
t|td��|j
t|t��|j
t|d�|j
t||dz�|j
t|d�|j
t|d	�|j
t|d
�|j
t|t�y#1swY��4xYw)Nr)�SIZE_MAXr0r�rr�r>rEr�r�)
r�pylong_as_size_tr�r8r:rrWr�rrrXr�r`)r�	as_size_tr�rs    r�test_long_as_size_tzLongTests.test_long_as_size_tSs���.�.�	�&���1�d�+�	:�E����E��*�
:�� � ��5�!1�5�9�
:�
:�	:�	
����;�r�?�3�R�8����)�Y��b�	�:����)�Y�
��@����-��B�7����-��H�q�L�A����)�Y��4����)�Y��5����)�Y��4����+�y�$�7�
:�
:�r�c�8�tj}ttjj
�}||ddddfD]Z}|j
|��5|j||�t|��|j||�t�ddd��\|j|td��d�|jt|td��|jt|t��|jt|d|z�|jt|d	|z�|jt|d
�|jt|d�|jt|d�|jt |t"�y#1swY��\xYw)
Nr>rr0r�rr�gE@r%���rEr�r�)r�pylong_asdoublerVr@rTrUr8r:rYrarrWr�rrrXr�r`)r�asdouble�MAXrs    r�test_long_asdoublezLongTests.test_long_asdoublegsL���,�,���#�.�.�$�$�%���d�C��Q��4�0�	>�E����E��*�
>�� � ��%��%��,�?��%�%�h�u�o�u�=�
>�
>�	>�
	
����+�b�/�2�D�9����)�X�u�R�y�9����)�X�}��?����-��1�s�7�;����-��2��8�<����)�X�s�3����)�X�t�4����)�X�s�3����+�x��6�
>�
>�s�>F�F	c���tj}tj}t�}||�}|t�}|j||�|�|j||�t�|j|t
|��|�dtjdzz}||dzk\r|j|||z
�|�||dzk\r|j|||z
�t�|jt|t|��|jt|t��|jt|ddz�|jt|ddz�y)Nr0�r%i�)rr_�pylong_asvoidptrrIr`�assertIsr�
SIZEOF_VOID_PrWr�rrX)rrd�	asvoidptrrerfrg�Ms       r�test_long_asvoidptrzLongTests.test_long_asvoidptr{s!���2�2���.�.�	��h�����������
�
�i��l�C�(��
�
�i��l�D�)��
�
�i��A��/��5��)�)�)�A�-�
-����1��9��M�M�)�A��E�*�C�0���1��9��M�M�)�A��E�*�D�1����)�Y��a��9����)�Y���9����-��A�t�G�<����-��Q��W�H�=rN)rrr	r<rBrLrOr]rhrwr�r�r�r�r�r�r�r�r�r�r�r�r�r
rrr!r!sn��/� &�	*�	*�	@�
"�D�<K�<5�(C�$=�(A�(9�(H�$A�(E�(9�(8�(7�(>rr!�__main__)�unittestr@�test.supportr�
import_modulerr`rVrrr�TestCaser!r�mainr
rr�<module>r�sv���
�&�
(�M�'�'��4�	���	�#�	�����s>��!�!�s>�n�z���H�M�M�O�r