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_int.cpython-312.pyc

�

'Μg����ddlZddlZddlZddlmZddlmZddlmZmZ	ddl	Z	ddddd	d
ddd
deej�ejfde
fdde
fde
fde
fde
fde
fgZGd�de�ZGd�dej"�ZGd�dej"�ZGd�de�ZGd�dej"�Zed k(rej.�yy#e
$rdZ	Y��wxYw)!�N)�mock)�support)�VALID_UNDERSCORE_LITERALS�INVALID_UNDERSCORE_LITERALS)�0r)�1�)�9�	)�10�
)�99�c)�100�d)�314�:)z 314r)z314 r)z  		  314  		  rz  1x)z  1  r	z  1  �� �  		  uȀc��eZdZy)�IntSubclassN��__name__�
__module__�__qualname__���*/usr/local/lib/python3.12/test/test_int.pyrr$s��rrc��eZdZd�Zd�Zd�Zd�Zejd��Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�IntTestCasesc�d�|jtd�d�|jtd�d�|jtd�d�|jtd�d�|jtd�d�|jtd�d�|jtd	�d�|jtd
�d�|jtd�d�|jtd�d�|jtd
d�d�tD]I\}}dD]?}dD]8}||z|z}|}|dk(r|tur|}	|jt|�|��:�A�Kt	dt
jz
�}t|�}|j|dzt
j�|j|t�|jt|dd�t
jdz�td�}|j|t�td�}|j|t�dt
jz
}|j|dz	|dz�td�}|j|t�|jttdd�|jtdd�d�|jtdd�d�|jttdd�|jttdd�|jttdd �|jttdd�|jttd!d�|jttd!d�|jtd"d�d#�|jtd$d�d#�|jtd%d&�d#�|jtd'd(�d#�|jtd)d*�d#�|jtd+d,�d#�|jtd-d �d#�|jtd.d/�d#�|jtd0d1�d#�|jtd2d3�d#�|jtd4d�d#�|jtd5d6�d#�|jtd7d8�d#�|jtd9d:�d#�|jtd;d�d#�|jtd<d=�d#�|jtd>d?�d#�|jtd@dA�d#�|jtdBdC�d#�|jtdDdE�d#�|jtdFdG�d#�|jtdHdI�d#�|jtdJdK�d#�|jtdLdM�d#�|jtdNdO�d#�|jtdPdQ�d#�|jtdRdS�d#�|jtdTdU�d#�|jtdVdW�d#�|jtdXdY�d#�|jtdZd[�d#�|jtd\d]�d#�|jtd^d_�d#�|jtd`da�d#�|jtdbdc�d#�|jtddd�d�|jtddd�d�|jtded�d�|jtdd�d�|jtdd�d�|jtdfd�d&�|jtdgd�d�|jtdhd�d�|jtdid�d&�|jt�5tdjd�ddd�|jtdk�dl�|jtdkd1�dl�|jtdd�d�|jtdd �d�|jtdfd�d&�|jtdmd�d�|jtdnd �d�|jtdod�d&�|jttdpd�|jttdqd�|jttdrd�|jttdsd�|jttdtd �|jttdud �|jttdvd �|jttdwd �|jttdxd�|jttdyd�|jttdzd�|jttd{d�|jtd|d�d}�|jtd~d�d}�|jtdd&�d}�|jtd�d(�d}�|jtd�d*�d}�|jtd�d,�d}�|jtd�d �d}�|jtd�d/�d}�|jtd�d1�d}�|jtd�d3�d}�|jtd�d�d}�|jtd�d6�d}�|jtd�d8�d}�|jtd�d:�d}�|jtd�d�d}�|jtd�d=�d}�|jtd�d?�d}�|jtd�dA�d}�|jtd�dC�d}�|jtd�dE�d}�|jtd�dG�d}�|jtd�dI�d}�|jtd�dK�d}�|jtd�dM�d}�|jtd�dO�d}�|jtd�dQ�d}�|jtd�dS�d}�|jtd�dU�d}�|jtd�dW�d}�|jtd�dY�d}�|jtd�d[�d}�|jtd�d]�d}�|jtd�d_�d}�|jtd�da�d}�|jtd�dc�d}�y#t$rY�
�cwxYw#1swY��xYw)�Nrg��Q�	@�g��Q�	����g333333@g333333�g@g�z-3z -3 u -3 r�)r�+�-)rr�	rr'���r	g}Ô%�I�Tg}Ô%�I����X111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111��0o123r�S�0x123i#�0x�0o��0b�!100000000000000000000000000000000l�102002022201221111211�10000000000000000��32244002423141��
1550104015504��211301422354��40000000000�12068657454r�
4294967296r
�
1904440554��	9ba461594�	535a79889�
�	2ca5b7464��	1a20dcd81��	100000000�a7ffda91��704he7g4��4f5aff66��3723ai4g��281d55i4��1fj8b184��1606k7ic��mb994ag��hek2mgl��dnchbnm��b28jpdm��8pfgih4��76beigg��5qmcpqg��4q0jto4��4000000� �3aokq94�!�2qhxjli�"�2br45qb�#�1z141z4�$z 0o123  �000�0b100z	 0O123   z 0X123  z 0B100 �010�0123�{�0X123�0O123�0B100�0b2�0b02�0B2�0B02�0o8�0o08�0O8�0O08�0xg�0x0g�0Xg�0X0g�!100000000000000000000000000000001l�102002022201221111212�10000000000000001�32244002423142�
1550104015505�211301422355�40000000001�12068657455�
4294967297�
1904440555�	9ba461595�	535a7988a�	2ca5b7465�	1a20dcd82�	100000001�a7ffda92�704he7g5�4f5aff67�3723ai4h�281d55i5�1fj8b185�1606k7id�mb994ah�hek2mgm�dnchbnn�b28jpdn�8pfgih5�76beigh�5qmcpqh�4q0jto5�4000001�3aokq95�2qhxjlj�2br45qc�1z141z5)
�assertEqual�int�L�
ValueError�repr�sys�maxsize�assertIsInstance�assertRaises�	TypeError)�self�s�v�sign�prefix�ss�vv�xs        r�
test_basiczIntTestCases.test_basic)s�������S��3�'�����T��A�&�����U��R�(�����S��1�%�����T��B�'�����S��1�%�����T��B�'�����T��B�'�����V��b�)�����9�:�B�?�����T�"��r�*��D�A�q�$��7�F��$���*�B��B��s�{�q�
�':��R����(�(��R��"�5�
8�%��
��C�K�K�� ����F������1��s�{�{�l�+����a��%�����Q�q�r�U��S�[�[��]�3�
��J�����a��%���K�����a��%�
�s�{�{�N������a���A��&��	�N�����a��%�	
���)�S�!�R�0�����W�a��"�-�����W�b�)�3�/�	
���*�c�4��4����*�c�4��3����*�c�4��3����*�c�4��3����*�c�4��3����*�c�4��3�	
����@�!�D�j�Q�����4�a�8�*�E�����0�!�4�j�A�����-�q�1�:�>�����_�a�0�*�=�����^�Q�/��<�����]�A�.�
�;�����]�A�.�
�;�����\�2�.�
�;�����\�2�.�
�;�����[�"�-�z�:�����[�"�-�z�:�����[�"�-�z�:�����[�"�-�z�:�����[�"�-�z�:�����Z��,�j�9�����Z��,�j�9�����Z��,�j�9�����Z��,�j�9�����Z��,�j�9�����Z��,�j�9�����Z��,�j�9�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�	
����Z��+�R�0�����Z��+�R�0�����U�A���*�����W�a��"�-�����W�a��#�.�����W�a��!�,�����[�!�,�b�1�����Z��+�S�1�����Y��*�A�.�
�
�
�z�
*���q�M�+�	
����V��c�*�����V�R��#�.�	
����W�b�)�3�/�����W�a��"�-�����W�a��!�,�����W�b�)�3�/�����W�a��"�-�����W�a��!�,�	
���*�c�5�!�4����*�c�6�1�5����*�c�5�!�4����*�c�6�1�5����*�c�5�!�4����*�c�6�1�5����*�c�5�!�4����*�c�6�1�5����*�c�5�"�5����*�c�6�2�6����*�c�5�"�5����*�c�6�2�6�	
����@�!�D�j�Q�����4�a�8�*�E�����0�!�4�j�A�����-�q�1�:�>�����_�a�0�*�=�����^�Q�/��<�����]�A�.�
�;�����]�A�.�
�;�����\�2�.�
�;�����\�2�.�
�;�����[�"�-�z�:�����[�"�-�z�:�����[�"�-�z�:�����[�"�-�z�:�����[�"�-�z�:�����Z��,�j�9�����Z��,�j�9�����Z��,�j�9�����Z��,�j�9�����Z��,�j�9�����Z��,�j�9�����Z��,�j�9�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8�����Y��+�Z�8��&�����z+�
*�s�z�<
z%�	z"	�!z"	�%z/c��|jt�5td�ddd�|jt�5td�ddd�|jt�5td�ddd�|jt�5td�ddd�|jt�5td�ddd�y#1swY��xYw#1swY��xYw#1swY�txYw#1swY�WxYw#1swYyxYw)Nr&r'z- 1z+ 1z + 1 �r�r�r��r�s r�test_invalid_signszIntTestCases.test_invalid_signs�s���
�
�
�z�
*���H�+�
�
�
�z�
*���H�+�
�
�
�z�
*���J�+�
�
�
�z�
*���J�+�
�
�
�z�
*���L�+�
*�+�
*��
*�
*��
*�
*��
*�
*��
*�
*�s:�C�C�(C'�C3�:C?�C�C$�'C0�3C<�?Dc���|jtd�d�|jtd�d�|jtdd�d�|jtdd�d�y)Nu(१२३४५६७८९०1234567890l�
>V3&�Z
u١٢٣٤٥٦٧٨٩٠i��Ir�r�r�r�s r�test_unicodezIntTestCases.test_unicode�s`������G�H�J^�_�����3�4�j�A�����G��K�Ma�b�����3�Q�7��Drc
����tD]r�t�fd�dD��r�|jt�d�t	���|jt�d�t�jdd�d���ttD]3�t�fd�dD��r�|jtt�d��5|jtdd�d	�|jtd
�d�|jtd�d�|jttd
�|jttd�|jttd�|jttd�y)Nc3�&�K�|]}|�v���
y�w�Nr��.0�ch�lits  �r�	<genexpr>z0IntTestCases.test_underscores.<locals>.<genexpr>�������/�w��2��9�w���z.eEjJr�_rc3�&�K�|]}|�v���
y�wr�rr�s  �rr�z0IntTestCases.test_underscores.<locals>.<genexpr>�r�r��1_00r#r�0_100rs1_00�_100z+_100�1__00�100_)	r�anyr�r��eval�replacerr�r�)r�r�s @r�test_underscoreszIntTestCases.test_underscores�s���,�C��/�w�/�/�����S��a�[�$�s�)�4����S��a�[�#�c�k�k�#�r�.B�A�*F�G�	-�
/�C��/�w�/�/�����j�#�s�A�6�/�
	
����V�Q���+�����W��s�+�����W��s�+����*�c�6�2����*�c�7�3����*�c�7�3����*�c�6�2rc���|jtd�d�|jtd�d�|jtd�d�|jtd�d�y)Nrr
z-1r)s10s-1)�assertIsr�r�s r�test_small_intszIntTestCases.test_small_intssL��	
�
�
�c�$�i��$��
�
�c�$�i��$��
�
�c�%�j�"�%��
�
�c�%�j�"�%rc�8�|jt�d�y�Nrr�r�s r�test_no_argszIntTestCases.test_no_argss��������"rc��|jtdd��d�|jtd�5td��ddd�|jtd�5tdd��ddd�|j	ttd	��|j	ttd
��y#1swY�nxYw#1swY�NxYw)Nrr*��baser7zkeyword argumentg333333�?)r�)r�r�r
r)r�r��assertRaisesRegexr�r�r�s r�test_keyword_argszIntTestCases.test_keyword_argss�������U��+�Q�/�
�
#�
#�I�/A�
B��#�J�C�
�
#�
#�I�/A�
B��%�a� �C����)�S�r��2����)�S�q��1�C�
B��
B�
B�s�
B.�B:�.B7�:Cc���|jtdd�d�|jt�5tdd�ddd�|jt�5tdd�ddd�|jt�5tdd�ddd�|jt�5tdddd	zz
�
�ddd�|jt�5tddd	z�
�ddd�t	dd�D]}|jtd|�
�d��!y#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY�hxYw)z9Testing the supported limits of the int() base parameter.rr9rr	N�%is���r*��r�)r�r�r�r��range�r�r�s  r�test_int_base_limitsz!IntTestCases.test_int_base_limitss������S�!��a�(�
�
�
�z�
*���Q�K�+�
�
�
�z�
*���R�L�+�
�
�
�z�
*���T�N�+�
�
�
�z�
*���!�Q��V�*�%�+�
�
�
�z�
*���!�S�&�!�+��!�B�K�D����S��4�0�!�4� �+�
*��
*�
*��
*�
*��
*�
*��
*�
*�s;�
D)�
D5�
E�0E
�!E�)D2�5D>�E
�
E�E"c���|jt�5tdd�ddd�|jt�5tdd�ddd�y#1swY�4xYw#1swYyxYw)z2Not integer types are not valid bases; issue16772.rg@Ng@)r�r�r�r�s r�test_int_base_bad_typesz$IntTestCases.test_int_base_bad_types-sM��
�
�
�y�
)���S�M�*�
�
�
�y�
)���S�M�*�
)�*�
)��
)�
)�s�
A�
A"�A�"A+c��Gd�dt�}ddzddzddfD],}|jt�5td|�ddd��.|j	td|d��	�d
�|j	td|d��	�d�|j	td|d
��	�d�y#1swY��xYw)Nc��eZdZd�Zd�Zy)�9IntTestCases.test_int_base_indexable.<locals>.MyIndexablec��||_yr���value)r�r�s  r�__init__zBIntTestCases.test_int_base_indexable.<locals>.MyIndexable.__init__6s	��"��
rc��|jSr�r�r�s r�	__index__zCIntTestCases.test_int_base_indexable.<locals>.MyIndexable.__index__8s���z�z�!rN)rrrr�r�rrr�MyIndexabler�5s��
#�
"rr�r*rr	r��43�101r�r9r
�erri)�objectr�r�r�r�)r�r�r�s   r�test_int_base_indexablez$IntTestCases.test_int_base_indexable4s���	"�&�	"��s�F�Q��V�G�Q��*�D��"�"�:�.��D�$��/�.�+�
	
����U��Q��8�!�<�����U��R��9�3�?�����U��R��9�9�E�
/�.�s�
B6�6B?	c�����Gd�dt��Gd�dt�}Gd�dt�}tt�fd�||tg}	dd	lm�|j�fd
��|D]�}|d�}|jt|��5|jt|�d�t|tttf�r|jt|d
�d�n-d}|jt|�5t|d
�ddd�|jtd�5t|d��ddd�ddd���y#t$rY��wxYw#1swY�SxYw#1swY�/xYw#1swY��xYw)Nc��eZdZy)�<IntTestCases.test_non_numeric_input_types.<locals>.CustomStrNrrrr�	CustomStrr�H��rr�c��eZdZy)�>IntTestCases.test_non_numeric_input_types.<locals>.CustomBytesNrrrr�CustomBytesrIr�rrc��eZdZy)�BIntTestCases.test_non_numeric_input_types.<locals>.CustomByteArrayNrrrr�CustomByteArrayrJr�rrc�0���|j��Sr�)�decode)�br�s �r�<lambda>z;IntTestCases.test_non_numeric_input_types.<locals>.<lambda>Os���i����
�+rr)�arrayc����d|�S)N�Br)rr
s �rr	z;IntTestCases.test_non_numeric_input_types.<locals>.<lambda>Ys���u�S�!�}rs100rr*r7zcan't convert non-stringzinvalid literalsAAAAAAAAAAAAAAAA)�str�bytes�	bytearray�
memoryviewr
�append�ImportError�subTest�typer�r��
isinstancer�r�r�)	r�rr�	factories�fr��msgr�r
s	       @@r�test_non_numeric_input_typesz)IntTestCases.test_non_numeric_input_typesEs,���	#��"�&�%�&�.�i�.�
��+����

�	�	6�#�
���4�5��A��&�	�A����d�1�g�&�� � ��Q���-��a�#�u�i�!8�9��$�$�S��A�Y��2�4�C��/�/�	�3�?��A�q�	�@��+�+�J�8I�J���+��'�K�'�&����	��	��@�?��J�J��'�&�sO�E�	A,E,�5
E�E,� E �2E,�	E�E�E�E,� E)�%E,�,E6	c��|jttd�dd�d�|jttd�dd�d�|jttd�dd�d�|jttd�dd�d�|jttd�dd�d�y)	Ns123r	r#rX�123s123 s123As1234)r�r�rr�s r�test_int_memoryviewz IntTestCases.test_int_memoryviewhs�������Z��/��!�4�5�r�:�����Z�
�3�A�a�8�9�2�>�����Z��0��1�5�6��;�����Z��0��1�5�6��;�����Z��0��1�5�6��;rc�:�|jttd�y)Nz1.2r�r�s r�test_string_floatzIntTestCases.test_string_floatos�����*�c�5�1rc	������Gd�d�}|jtt|��Gd�dt�}|jtt|��Gd�d�}|j	t|��d�Gd�d	�}t|fD�]L}Gd
�d|�}|j	t|��d�Gd�d
|�}|jt�5|j	t|��d�ddd�Gd�d|�}|jt�5|jt�5t|��ddd�ddd�t|fD�]r}	Gd�d|	��G�fd�d|�}
|jt�5|j	t|
��d�ddd�Gd�d|	��G�fd�d|�}|jt�5|j	t|
��d�ddd�G�fd�d|	��G�fd�d|�}	|jt�5t|��ddd�|jd||	f���Gd�d|	��G�fd �d!|�}|jt�5|jt�5t|��ddd�ddd���u��Oy#1swY���xYw#1swY���xYw#1swY���xYw#1swY��QxYw#1swY��xYw#1swY��xYw#t$r%}
|j	t|
�d�Yd}
~
��d}
~
wwxYw#1swY��xYw#1swY��xYw)"Nc��eZdZy)�>IntTestCases.test_intconversion.<locals>.ClassicMissingMethodsNrrrr�ClassicMissingMethodsr!t���rr"c��eZdZy)�7IntTestCases.test_intconversion.<locals>.MissingMethodsNrrrr�MissingMethodsr%xr#rr&c��eZdZd�Zy)�-IntTestCases.test_intconversion.<locals>.Foo0c��y�N�*rr�s r�__int__z5IntTestCases.test_intconversion.<locals>.Foo0.__int__}���rN�rrrr,rrr�Foo0r(|���
rr/r+c��eZdZy)�0IntTestCases.test_intconversion.<locals>.ClassicNrrrr�Classicr2�r#rr3c��eZdZd�Zd�Zy)�:IntTestCases.test_intconversion.<locals>.IntOverridesTruncc��yr*rr�s rr,zBIntTestCases.test_intconversion.<locals>.IntOverridesTrunc.__int__����rc��y)Ni�rr�s r�	__trunc__zDIntTestCases.test_intconversion.<locals>.IntOverridesTrunc.__trunc__�s��rN)rrrr,r9rrr�IntOverridesTruncr5�s���rr:c��eZdZd�Zy)�2IntTestCases.test_intconversion.<locals>.JustTruncc��yr*rr�s rr9z<IntTestCases.test_intconversion.<locals>.JustTrunc.__trunc__�r7rN�rrrr9rrr�	JustTruncr<�s��rr?c��eZdZd�Zy)�9IntTestCases.test_intconversion.<locals>.ExceptionalTruncc��ddzy)Nr	rrr�s rr9zCIntTestCases.test_intconversion.<locals>.ExceptionalTrunc.__trunc__�s	����ErNr>rrr�ExceptionalTruncrA�s��rrCc��eZdZd�Zy)�.IntTestCases.test_intconversion.<locals>.Indexc��yr*rr�s rr�z8IntTestCases.test_intconversion.<locals>.Index.__index__����!rN�rrrr�rrr�IndexrE����"rrIc���eZdZ�fd�Zy)�;IntTestCases.test_intconversion.<locals>.TruncReturnsNonIntc�����Sr�r)r�rIs �rr9zEIntTestCases.test_intconversion.<locals>.TruncReturnsNonInt.__trunc__�s
���$�w�rNr>)rIs�r�TruncReturnsNonIntrL�s���'rrNc��eZdZd�Zy)�0IntTestCases.test_intconversion.<locals>.Intablec��yr*rr�s rr,z8IntTestCases.test_intconversion.<locals>.Intable.__int__�rGrNr.rrr�IntablerP�rJrrRc���eZdZ�fd�Zy)�=IntTestCases.test_intconversion.<locals>.TruncReturnsNonIndexc�����Sr�r)r�rRs �rr9zGIntTestCases.test_intconversion.<locals>.TruncReturnsNonIndex.__trunc__�s���&�y�(rNr>)rRs�r�TruncReturnsNonIndexrT�s���)rrVc���eZdZ�fd�Zy)�4IntTestCases.test_intconversion.<locals>.NonIntegralc�����Sr�r�r��NonIntegrals �rr9z>IntTestCases.test_intconversion.<locals>.NonIntegral.__trunc__�s���*�}�,rNr>�r[s�rr[rX�s���-rr[c���eZdZ�fd�Zy)�@IntTestCases.test_intconversion.<locals>.TruncReturnsNonIntegralc�����Sr�rrZs �rr9zJIntTestCases.test_intconversion.<locals>.TruncReturnsNonIntegral.__trunc__�s���*�}�,rNr>r\s�r�TruncReturnsNonIntegralr^�s���-rr`zFailed to raise TypeError with z2__trunc__ returned non-Integral (type NonIntegral)c��eZdZd�Zy)�/IntTestCases.test_intconversion.<locals>.BadIntc��y�NgE@rr�s rr,z7IntTestCases.test_intconversion.<locals>.BadInt.__int__�s��#rNr.rrr�BadIntrb�s��$rrec���eZdZ�fd�Zy)�;IntTestCases.test_intconversion.<locals>.TruncReturnsBadIntc�����Sr�r�r�res �rr9zEIntTestCases.test_intconversion.<locals>.TruncReturnsBadInt.__trunc__�s
���%�x�rNr>�res�r�TruncReturnsBadIntrg�s���(rrk)
r�r�r�r�r��assertWarns�DeprecationWarning�ZeroDivisionError�failr
)r�r"r&r/r3r�r:r?rC�trunc_result_baserNrVr`�erkrerIrRr[s               @@@@r�test_intconversionzIntTestCases.test_intconversionrs����	�	����)�S�*?�*A�B�	�V�	����)�S�.�*:�;�	�	�	
����T�V��b�)�	�	��W�%�D�
�D�
�

���S�!2�!4�5�r�:�
�D�
��!�!�"4�5�� � ��Y�[�!1�2�6�6�
�4�
��"�"�#4�5��!�!�"4�5��$�&�'�6�6�'-�g�%6�!�"�-�"�'��'��%�%�&8�9��$�$�S�);�)=�%>��C�:�"�/�"�)�4�)��%�%�&8�9��$�$�S�);�)=�%>��C�:�-�"3�-�
-�d�-�	<��)�)�*<�=��3�5�6�>��I�I� $�&7�8�;�<�$�.�$�(��(��&�&�y�1��%�%�&8�9��*�,�-�:�2�1�c&7�+&�6�5��6�5��6�5��:�9��:�9��>�=�� �=��$�$�S��V�'<�=�=��=��$:�9��2�1�s��)!K+�2L�K8�L�"!L�8!L�<L8�L,�"L8�-M5�M)	�M5�+K5	�8L�=L�L	�L�L)�,L5�1L8�8	M&�M!�!M&�)M2
�.M5�5M?c���Gd�dt�}Gd�dt�}|d�}|j|d�|jt|�d�|jt|��d�y)Nc��eZdZd�Zy)�:IntTestCases.test_int_subclass_with_index.<locals>.MyIndexc��yr*rr�s rr�zDIntTestCases.test_int_subclass_with_index.<locals>.MyIndex.__index__�r-rNrHrrr�MyIndexru�r0rrwc��eZdZd�Zy)�;IntTestCases.test_int_subclass_with_index.<locals>.BadIndexc��yrdrr�s rr�zEIntTestCases.test_int_subclass_with_index.<locals>.BadIndex.__index__����rNrHrrr�BadIndexry����
rr|r=r)r�r�)r�rwr|�my_ints    r�test_int_subclass_with_indexz)IntTestCases.test_int_subclass_with_index�s_��	�c�	�	�s�	����������#�����V��a�(�����X�Z��!�,rc��Gd�dt�}Gd�dt�}|d�}|j|d�|jt|�d�|d�}|j|d�|jtt|�y)Nc��eZdZd�Zy)�6IntTestCases.test_int_subclass_with_int.<locals>.MyIntc��yr*rr�s rr,z>IntTestCases.test_int_subclass_with_int.<locals>.MyInt.__int__�r-rNr.rrr�MyIntr��r0rr�c��eZdZd�Zy)�7IntTestCases.test_int_subclass_with_int.<locals>.BadIntc��yrdrr�s rr,z?IntTestCases.test_int_subclass_with_int.<locals>.BadInt.__int__�r{rNr.rrrrer��r}rrer=r+)r�r�r�r�)r�r�rer~s    r�test_int_subclass_with_intz'IntTestCases.test_int_subclass_with_int�st��	�C�	�	�S�	��q��������#�����V��b�)����������#����)�S�&�1rc���	�
�Gd�d��	Gd�dt�}Gd�d��
Gd�dt�}G�	fd	�d
�}G�
fd�d�}Gd
�d�}�	�}|jt�5t|�}ddd�|jd�|j	t|�t�|�}t|�}|j|d�|j	t|�t��
�}|jt�5t|�}ddd�|j|d�|j	t|�t�|�}|jt�5t|�}ddd�|j|d�|j	t|�t�|�}|jt�5t|�}ddd�|j|d�|j	t|�t�|�}|jt�5|j
tt|�ddd�|�}|jt�5t|�}ddd�|j|d�|j	t|�t�|jt�5t|�}ddd�|j|d�|j	t|�t�y#1swY���xYw#1swY��xYw#1swY���xYw#1swY��^xYw#1swY��xYw#1swY��xYw#1swY��xYw)Nc��eZdZd�Zy)�<IntTestCases.test_int_returns_int_subclass.<locals>.BadIndexc��y�NTrr�s rr�zFIntTestCases.test_int_returns_int_subclass.<locals>.BadIndex.__index__�r{rNrHrrrr|r��r}rr|c��eZdZd�Zy)�=IntTestCases.test_int_returns_int_subclass.<locals>.BadIndex2c��yr�rr�s rr�zGIntTestCases.test_int_returns_int_subclass.<locals>.BadIndex2.__index__�r{rNrHrrr�	BadIndex2r��r}rr�c��eZdZd�Zy)�:IntTestCases.test_int_returns_int_subclass.<locals>.BadIntc��yr�rr�s rr,zBIntTestCases.test_int_returns_int_subclass.<locals>.BadInt.__int__�r{rNr.rrrrer��r}rrec��eZdZd�Zy)�;IntTestCases.test_int_returns_int_subclass.<locals>.BadInt2c��yr�rr�s rr,zCIntTestCases.test_int_returns_int_subclass.<locals>.BadInt2.__int__�r{rNr.rrr�BadInt2r��r}rr�c���eZdZ�fd�Zy)�HIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadIndexc�����Sr�r)r�r|s �rr9zRIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadIndex.__trunc__s����z�!rNr>)r|s�r�TruncReturnsBadIndexr��s���
"rr�c���eZdZ�fd�Zy)�FIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadIntc�����Sr�rris �rr9zPIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadInt.__trunc__s
����x�rNr>rjs�rrkr�s���
 rrkc��eZdZd�Zy)�KIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsIntSubclassc��yr�rr�s rr9zUIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsIntSubclass.__trunc__r{rNr>rrr�TruncReturnsIntSubclassr�r}rr�r	r)	r�rlrmr�r�rr�r�r)r�r�r�r�rkr��bad_int�n�good_intr|res         @@r�test_int_returns_int_subclassz*IntTestCases.test_int_returns_int_subclass�s����	�	�	��	�	�	�	�c�	�	"�	"�	 �	 �	�	��*��
�
�
�0�
1��G��A�2�����A���
�
�d�1�g�s�#��+����L������A���
�
�d�1�g�s�#��(��
�
�
�0�
1��G��A�2�����A���
�
�d�1�g�s�#��)��
�
�
�0�
1��G��A�2�����A���
�
�d�1�g�s�#�&�(��
�
�
�0�
1��G��A�2�����A���
�
�d�1�g�s�#�$�&��
�
�
�0�
1����i��g�6�2�+�,��
�
�
�0�
1��H�
�A�2�����A���
�
�d�1�g�s�#�
�
�
�0�
1��H�%�A�2�����A���
�
�d�1�g�{�+�Q2�
1��2�
1��2�
1��2�
1��2�
1��2�
1��2�
1�sT�3L�L'�8L4�M�:M�:M�M&�L$�'L1�4L>�M�M�M#�&M/c���d�fd�	}|d�|d�|d�|d�|dd�|dd�|dd	�|d
d�|d
d	�|d�|dd�|d�|dd�|d
�|d
d�y)Nc����jtd|�d|�d���5}|�t|�nt||�ddd��jjj
dd|�dn||fz�y#1swY�<xYw)Nzint(z, �))rrz*invalid literal for int() with base %d: %rr
)r�r�r�r��	exception�args)r�r��cmr�s   �r�checkz.IntTestCases.test_error_message.<locals>.check7s�����"�"�:�89�4�'@�#�B�EG��<���F���4�L�B�
���R�\�\�.�.�q�1�<��|���q�1�2�
3�
B�B�s�A6�6A?�½u123½z  123 456  z123r
z123 245rRr%z123245rs123�u123�r�r)r�r�s` r�test_error_messagezIntTestCases.test_error_message6s����		3�	�f�
�
�i��
�m��
�i��
�i���
�m�R� �
�m�R� �
�l�B��
�l�B��
�j��
�j�"��
�j��
�j�"��
�k��
�k�2�rc���|jtdd�d�|jtdd�d�|jtdd�d	�|jtd
d�d�y)
N�=1_0_1_0_1_0_1_0_1_0_1_0_1_0_1_0_1_0_1_0_1_0_1_0_1_0_1_0_1_0_1r*iUUUU�1_2_3_4_5_6_7_0_1_2_3r2iSp�S�1_2_3_4_5_6_7_8_9r%l�g�F�
1_2_3_4_5_6_7rji�2Dr�r�s r�test_issue31619zIntTestCases.test_issue31619Wse������\�^_�`�:�	<�����4�a�8�-�H�����0�"�5�{�C�����_�b�1�:�>rN)rrrr�r�r�r�r�cpython_onlyr�r�r�r�r�r�rrrrrrr�r�r�r�rrrr!r!'s���w9�r
�E�3�&
���&��&�#�2�5�"�F�"!(�F<�2�Z.�x
-�2�"F,�P�B?rr!c�v��eZdZeZ�fd�Z�fd�Zd�Zd�Zdd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Z�xZS)�IntStrDigitLimitsTestsc�~��t�|��tj�|_tj
d�y)Ni��super�setUpr��get_int_max_str_digits�_previous_limit�set_int_max_str_digits�r��	__class__s �rr�zIntStrDigitLimitsTests.setUpcs+���
��
��"�9�9�;����"�"�4�(rc�`��tj|j�t�|��yr��r�r�r�r��tearDownr�s �rr�zIntStrDigitLimitsTests.tearDownh�"����"�"�4�#7�#7�8�
���rc��|jtj�d�|jtj�d�t	j
d�5|j
tj�d�|jddz�}t|�ddd�|jtj�d�y#1swY�.xYw)Nr� Nr)	�
assertGreaterr�r��
assertLessr�adjust_int_max_str_digitsr��	int_classr
)r��is  r�test_disabled_limitz*IntStrDigitLimitsTests.test_disabled_limitls������3�5�5�7��;�����2�2�4�f�=�
�
.�
.�q�
1����S�7�7�9�1�=����s�V�|�,�A���F�2�	
���3�5�5�7��;�	2�
1�s
�AC�Cc	��|j}tj�}|d|z�|dd|zz�|d|zdz�|dd|zz�|dd|zz�|jt	td|dz
z��|�y)z&Ignore the +/- sign and space padding.rrr&r'r
r	N)r�r�r�r��lenr
)r�r��	maxdigitss   r�test_max_str_digits_edge_casesz5IntStrDigitLimitsTests.test_max_str_digits_edge_casesus����N�N�	��.�.�0�	��#�	�/�"��#��i��'�(��#�	�/�C�'�(��#��i��'�(��#��i��'�(�����S��	�A�
�!6�7�8�)�Drc��|jt�5|�|j|�n|j||�ddd�y#1swYyxYwr�)r�r�r�)r�r�r�s   rr�zIntStrDigitLimitsTests.check�s;��
�
�
�z�
*��|����q�!����q�$�'�	+�
*�
*�s�'A�Ac���tj�}|jd|dzz�|jdd|dzzz�|jd|dzzdz�|jdd|dzzz�|jdd|dzzz�|jd|dzz�d|z}|jt�5t|�ddd�y#1swYyxYw)Nrr	rr&r'r
)r�r�r�r�r�r
)r�r�r�s   r�test_max_str_digitsz*IntStrDigitLimitsTests.test_max_str_digits�s����.�.�0�	��
�
�3�)�a�-�(�)��
�
�3��	�A�
�.�.�/��
�
�3�)�a�-�(�3�.�/��
�
�3��	�A�
�.�.�/��
�
�3��	�A�
�.�.�/��
�
�3�)�a�-�(�)��)�O��
�
�
�z�
*���F�+�
*�
*�s�C�C#c�T�tj�}|dksJ|��tj}|�dkrtj}tdddz��d��}d}t
j|�5|�}t|�}d	d	d	�|�z
}|jt�|�|d
krtjd|�d���t
jtd
|z��5|jt�5}|�}t|�d	d	d	�|�|z
}	d	d	d	�|jdtj ��|j#	|dz�tdddz��d��}
|jt�5}|�}t|
�d	d	d	�|�|z
}|jdt|j ��|j%||dz�y	#1swY��sxYw#1swY��xYw#1swY��xYw#1swY�sxYw)�?Regression test: ensure we fail before performing O(N**2) work.iP�rr0�ci�r%r�i�1N��?�"slow" conversion took only �	 seconds.gףp=
��?�
conversionr*i �)r�r��time�process_time�	monotonicr�rr�r
r�r��unittest�SkipTestr�r��assertInr��assertLessEqualr�)r�r��get_time�huge_int�digits�start�huge_decimal�seconds_to_convert�err�seconds_to_fail_huge�extra_huge_int�seconds_to_fail_extra_huges            r�+test_denial_of_service_prevented_int_to_strzBIntStrDigitLimitsTests.test_denial_of_service_prevented_int_to_str�s����.�.�0�	��6�!�,�9�,�!��$�$���:��?��~�~�H���C��J�<�(�r�2����
�
.�
.�v�
6��J�E��x�=�L�7�&�Z�%�/������\�*�F�3���$��#�#�$B�'9�&:�)�%E�F�
F�
�
.�
.�s�4�&�=�/A�
B��"�"�:�.�#� �
���H�
�/�$,�:��#5� �	C�
	
�
�
�l�C��
�
�$6�7����1�3E�a�3G�H��r�#�g�+��/�b�9��
�
�
�z�
*�c��J�E����+�&.�Z�%�%7�"��
�
�l�C��
�
�$6�7����2�4F�q�4H�I�?7�
6��/�.��C�
B��+�
*�s<�5G9�4H�
H�H�H�9H�H	�H�H�H'c���tj�}|dksJ|��tj}|�dkrtj}d}d|z}tj|�5|�}t|�ddd�|�z
}|dkrtjd|�d���tj|d	z
�5|jt�5}|�}t|�ddd�|�|z
}ddd�|jd
tj��|j|dz�dd
z}	|jt�5}|�}t|	�ddd�|�|z
}
|jd
t|j��|j|
|dz�y#1swY��AxYw#1swY��xYw#1swY��xYw#1swY�sxYw)r�順riD
�8Nr�r�r�r	r�r*�7i�O)r�r�r�r�r�rr�r�r�r�r�r�r�r
r�r�)r�r�r�r��huger�r�r�r��
extra_huger�s           r�+test_denial_of_service_prevented_str_to_intzBIntStrDigitLimitsTests.test_denial_of_service_prevented_str_to_int�s����.�.�0�	��7�"�-�I�-�"��$�$���:��?��~�~�H����6�z��
�
.�
.�v�
6��J�E���I�7�&�Z�%�/����$��#�#�$B�'9�&:�)�%E�F�
F��
.�
.�v��z�
:��"�"�:�.�#� �
���D�	�/�$,�:��#5� �	;�
	
�
�
�l�C��
�
�$6�7����1�3E�a�3G�H���]�
�
�
�
�z�
*�c��J�E��
�O�+�&.�Z�%�%7�"��
�
�l�C��
�
�$6�7����7�9K�A�9M�N�97�
6��/�.��;�
:��+�
*�s<�'F9�G�G�+G�G�9G�G	�G�G�G'c���tj�}dD]Q}|j|��5|jd|dzz|�|dksJ�|jddz|�ddd��Sy#1swY�^xYw)z-The limit does not apply to power of 2 bases.)r*r7r2r%rjr�rr	r�N)r�r�rr�)r�r�r�s   r�!test_power_of_two_bases_unlimitedz8IntStrDigitLimitsTests.test_power_of_two_bases_unlimited�sn���.�.�0�	�%�D����4��(����s�i�!�m�4�d�;� �7�*�*�*����s�W�}�d�3�)�(�&�(�(�s�5A,�,A5	c���tj�}|dz}d|z}d|z}|j|�|j|�|j|�d��|j|�d��y)Nr#�111�1_11�_111)r�r�r�r�)r�r��triplesr��s_s     r�test_underscores_ignoredz/IntStrDigitLimitsTests.test_underscores_ignored�sh���.�.�0�	��q�.���G�O��
�g�
�����q�����r���
�
�a�S��9���
�
�b�T��;�rc���|j}tj�}d|z}||�}|d|���}||k(sJ�|d|���}||k(sJ�t|�t|�y)N�5r&r')r�r�r�r
)r�r��
max_digitsr�r��pos_i�neg_is       r�test_sign_not_countedz,IntStrDigitLimitsTests.test_sign_not_counted�st���N�N�	��/�/�1�
��*����a�L���A�a�S�'�"���E�z��z��A�a�S�'�"���v������E�
��E�
rc�b�|j}tj�}d|z}|||�}|dkDr*|jt�5t|�ddd�n|dkrt|�|jt�5}||�d�|�ddd�y#1swY�4xYw#1swYyxYw)N�2r
r)r�r�r�r�r�r
)r�r�r�rr�r�r�s       r�_other_base_helperz)IntStrDigitLimitsTests._other_base_helper
s����N�N�	��/�/�1�
��*����a�����"�9��"�"�:�.��A��/�.�
�B�Y���F�
�
�
�z�
*�c����1�g�t�$�+�
*�	/�.��+�
*�s�	B�
B%�B"�%B.c���d}|j|��5|j|�ddd�d}|j|��5|j|�ddd�y#1swY�8xYw#1swYyxYw)Nr#r�rr)rrr�s  r�test_int_from_other_basesz0IntStrDigitLimitsTests.test_int_from_other_basessc����
�\�\�t�\�
$��#�#�D�)�%���
�\�\�t�\�
$��#�#�D�)�%�
$�%�
$��%�
$�s�A�A*�A'�*A3c��d}tjd�5tj�}|j	tj
|�dd�tj�}|j	||�ddd�y#1swYyxYw)Na8if 1:
        # Subinterpreters maintain and enforce their own limit
        import sys
        sys.set_int_max_str_digits(2323)
        try:
            int('3'*3333)
        except ValueError:
            pass
        else:
            raise AssertionError('Expected a int max str digits ValueError.')
        i�rz%subinterp code failure, check stderr.)rr�r�r�r��run_in_subinterp)r��code�before_value�after_values    r�*test_int_max_str_digits_is_per_interpreterzAIntStrDigitLimitsTests.test_int_max_str_digits_is_per_interpretersr��
���
.�
.�t�
4��5�5�7�L����W�5�5�d�;�Q�D�
F��4�4�6�K����\�;�7�5�
4�
4�s�A!B�Br�)rrrr�r�r�r�r�r�r�r�r�r�r�r�rrr	r�
__classcell__�r�s@rr�r�_sS����I�)�
�<�
E�(��)J�V&O�P4�	 �
�%�*�8rr�c��eZdZeZy)�IntSubclassStrDigitLimitsTestsN)rrrrr�rrrrr4s���Irrc���eZdZ�fd�Z�fd�Zd�Zd�Zejd�d��Z	d�Z
d�Zeje
jed	�ej"j%ed
�d����Zeje
jed	�ej"j%ed�d
����Z�xZS)�PyLongModuleTestsc�~��t�|��tj�|_tj
d�yr�r�r�s �rr�zPyLongModuleTests.setUp<s+���
��
��"�9�9�;����"�"�1�%rc�`��tj|j�t�|��yr�r�r�s �rr�zPyLongModuleTests.tearDownAr�rc��t|�}|j|dd|�t|�}|j|d|z�d|z}|j||�d|z}|j||jd��y)Ni����r'z%ds%d�ascii)r
r��encode)r�r��suffixr��s2�s3�s4s       r�_test_pylong_int_to_decimalz-PyLongModuleTests._test_pylong_int_to_decimalEs{����F������3�4��&�)�
�!��W������S�1�W�%�
�A�X������Q��
�Q�Y������Q�X�X�g�.�/rc���|jddzd�|jddzdz
d�|jddzd�|jddzdz
d�|jd	d
zd�y)Nr	r��
9883109376�
9883109375r
i0u�
0000000000�
9999999999r#i`��
9313200001�rr�s r�test_pylong_int_to_decimalz,PyLongModuleTests.test_pylong_int_to_decimalOso���(�(�!�w�,��F��(�(�!�w�,�!�);�\�J��(�(��V��\�B��(�(��V��a���F��(�(��F��L�Ar�cpuc��|jddzd�|jddzd�|jddzd	�y)
Nr*i@B�
2747109376r
i�r#r#i�'	�
3132000001r&r�s r�test_pylong_int_to_decimal_2z.PyLongModuleTests.test_pylong_int_to_decimal_2Vs>���(�(��I��|�D��(�(��W��l�C��(�(��G��\�Brc�P�ddz}t|dzdz|�\}}|dk(r|dk(sJ�y)Nr	r�r#)�divmod)r�r��ars    r�test_pylong_int_divmodz(PyLongModuleTests.test_pylong_int_divmod\s8��
�'�\���a��c�A�g�q�!���1��A�v�!�q�&� � �&rc���ddz}t|�}t|�}||k(sJ�td|z�}||k(sJ�td|zdz�}||k(sJ�|jt�5}t|dz�ddd�|jt�5}t|dz�ddd�|jt�5}td|z�ddd�y#1swY�bxYw#1swY�BxYw#1swYyxYw)Nr	r�z -z +r�zr�)r
r�r�r�)r��v1r��v2�v3�v4r�s       r�test_pylong_str_to_intz(PyLongModuleTests.test_pylong_str_to_intas���
�'�\����G��
��V���R�x��x�
����]���s�b�y��y�
����C��
 ���R�x��x�
�
�
�z�
*�c���C��L�+�
�
�
�z�
*�c���C��L�+�
�
�
�z�
*�c���a��L�+�
*�	+�
*��
*�
*��
*�
*�s$�&C�C"�>C.�C�"C+�.C7z_pylong module required�int_to_decimal_stringc��tjd�5tddz�}d|_|j	t
�5}t
|�ddd�|jdt
j��td�|_
|j	t�5t
|�ddd�ddd�y#1swY�pxYw#1swY�xYw#1swYyxYw)Nr�r��Nz%_pylong.int_to_decimal_string did not�testABC)rr�r��return_valuer�r�r
r�r��RuntimeError�side_effect)r��mock_int_to_str�	big_value�ctxs    r�)test_pylong_misbehavior_error_path_to_strz;PyLongModuleTests.test_pylong_misbehavior_error_path_to_strqs���
�
.�
.�v�
6��C��J��I�+/�O�(��"�"�9�-���I��.��M�M�A��c�m�m�,�
.�*6�y�*A�O�'��"�"�<�0��I��1�7�
6�.�-��
1�0��7�
6�s<�+C�B<�
AC�C�+C�<C	�C�C	�
C�C�int_from_stringc��ddz}tjd�5d|_|jt�5}t|�ddd�|j
dtj��td�|_
|jt�5t|�ddd�ddd�y#1swY�pxYw#1swY�xYw#1swYyxYw)Nr�r:r�s
not an intz_pylong.int_from_string did not�test123)rr�r<r�r�r�r�r
r�r=r>)r��mock_int_from_strr@rAs    r�+test_pylong_misbehavior_error_path_from_strz=PyLongModuleTests.test_pylong_misbehavior_error_path_from_str�s���
��J�	�
�
.�
.�v�
6�-:��*��"�"�9�-���I��.��M�M�;��c�m�m�,�
.�-9��,C��)��"�"�<�0��I��1�7�
6�-�-��1�0��7�
6�s;�C�B3�AC�B?�"C�3B<	�8C�?C	�C�C)rrrr�r�rr'r�requires_resourcer,r0r7r�r��
skipUnless�_pylongr�patchr�rBrGrrs@rrr8s����&�
�0�B��W���u�%�C�&�C�
!�
� 
����X����";�<�	�Z�Z���w� 7�8��9�=���
����X����";�<�	�Z�Z���w� 1�2��3�=��rr�__main__)r�r�r�r�testr�test.test_grammarrrrJrr�r�r�r�r�r�TestCaser!r�rrr�mainrrr�<module>rQs��
�����<���
	���������$�	
�c�k�k�	�C�K�K�(�	����	�Z� �	�Z��	�j��	�Z� �	�:��%��*	�#�	�u?�8�$�$�u?�pR8�X�.�.�R8�j�%;��X��)�)�X�v�z���H�M�M�O���O���G��s�C�C�C

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