Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_int.cpython-39.opt-1.pyc

a

��g�q�@s�ddlZddlZddlZddlmZddlmZmZdddddd	d
ddd
eej	�ej	fde
fdde
fde
fde
fde
fde
fgZGdd�de�Z
Gdd�dej�ZGdd�dej�ZGdd�de�Zedkr�e��dS)�N)�support)�VALID_UNDERSCORE_LITERALS�INVALID_UNDERSCORE_LITERALS)�0r)�1�)�9�	)�10�
)Z99�c)�100�d)Z314�:)z 314r)z314 r)z  		  314  		  rz  1x)z  1  rz  1  �� �  		  uȀc@seZdZdS)�IntSubclassN��__name__�
__module__�__qualname__�rr�)/usr/local/lib/python3.9/test/test_int.pyrsrc@s�eZdZdd�Zdd�Zejdd��Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#S)$�IntTestCasescCsF	|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td	�d�|�td
�d�|�td�d�|�td�d�|�td
d�d�tD]l\}}dD]^}dD]T}|||}|}|dkr�|tur�|}z|�t|�|�Wq�t�yYq�0q�q�q�tdtj�}t|�}|�|dtj�|�|t�|�t|dd��tjd�td�}|�|t�td�}|�|t�dtj}|�|d?|d�td�}|�|t�|�t	tdd�|�tdd�d�|�tdd�d�|�ttdd�|�ttdd�|�ttdd �|�ttdd�|�ttd!d�|�ttd!d�|�td"d�d#�|�td$d�d#�|�td%d&�d#�|�td'd(�d#�|�td)d*�d#�|�td+d,�d#�|�td-d �d#�|�td.d/�d#�|�td0d1�d#�|�td2d3�d#�|�td4d�d#�|�td5d6�d#�|�td7d8�d#�|�td9d:�d#�|�td;d�d#�|�td<d=�d#�|�td>d?�d#�|�td@dA�d#�|�tdBdC�d#�|�tdDdE�d#�|�tdFdG�d#�|�tdHdI�d#�|�tdJdK�d#�|�tdLdM�d#�|�tdNdO�d#�|�tdPdQ�d#�|�tdRdS�d#�|�tdTdU�d#�|�tdVdW�d#�|�tdXdY�d#�|�tdZd[�d#�|�td\d]�d#�|�td^d_�d#�|�td`da�d#�|�tdbdc�d#�|�tddd�d�|�tddd�d�|�tded�d�|�tdd�d�|�tdd�d�|�tdfd�d&�|�tdgd�d�|�tdhd�d�|�tdid�d&�|�tdj�dk�|�tdjd1�dk�|�tdd�d�|�tdd �d�|�tdfd�d&�|�tdld�d�|�tdmd �d�|�tdnd�d&�|�ttdod�|�ttdpd�|�ttdqd�|�ttdrd�|�ttdsd �|�ttdtd �|�ttdud �|�ttdvd �|�ttdwd�|�ttdxd�|�ttdyd�|�ttdzd�|�td{d�d|�|�td}d�d|�|�td~d&�d|�|�tdd(�d|�|�td�d*�d|�|�td�d,�d|�|�td�d �d|�|�td�d/�d|�|�td�d1�d|�|�td�d3�d|�|�td�d�d|�|�td�d6�d|�|�td�d8�d|�|�td�d:�d|�|�td�d�d|�|�td�d=�d|�|�td�d?�d|�|�td�dA�d|�|�td�dC�d|�|�td�dE�d|�|�td�dG�d|�|�td�dI�d|�|�td�dK�d|�|�td�dM�d|�|�td�dO�d|�|�td�dQ�d|�|�td�dS�d|�|�td�dU�d|�|�td�dW�d|�|�td�dY�d|�|�td�d[�d|�|�td�d]�d|�|�td�d_�d|�|�td�da�d|�|�td�dc�d|�dS)�Nrg��Q�	@�g��Q�	����g333333@g333333�g@g�z-3z -3 u -3 r
�)r�+�-)rr�	rr���rg}Ô%�I�Tg}Ô%�I���AX111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111�Z0o123r�SZ0x123i#�0xZ0o�Z0bZ!100000000000000000000000000000000lZ102002022201221111211Z10000000000000000�Z32244002423141�Z
1550104015504�Z211301422354�Z40000000000Z12068657454r	Z
4294967296rZ
1904440554�Z	9ba461594Z	535a79889�
Z	2ca5b7464�Z	1a20dcd81�Z	100000000Za7ffda91�Z704he7g4�Z4f5aff66�Z3723ai4g�Z281d55i4�Z1fj8b184�Z1606k7ic�Zmb994ag�Zhek2mgl�Zdnchbnm�Zb28jpdm�Z8pfgih4�Z76beigg�Z5qmcpqg�Z4q0jto4�Z4000000� Z3aokq94�!Z2qhxjli�"Z2br45qb�#Z1z141z4�$z 0o123  Z000Z0b100z	 0O123   z 0X123  z 0B100 Z0123�{Z0X123Z0O123Z0B100Z0b2Z0b02Z0B2Z0B02Z0o8Z0o08Z0O8Z0O08Z0xgZ0x0gZ0XgZ0X0gZ!100000000000000000000000000000001lZ102002022201221111212Z10000000000000001Z32244002423142Z
1550104015505Z211301422355Z40000000001Z12068657455Z
4294967297Z
1904440555Z	9ba461595Z	535a7988aZ	2ca5b7465Z	1a20dcd82Z	100000001Za7ffda92Z704he7g5Z4f5aff67Z3723ai4hZ281d55i5Z1fj8b185Z1606k7idZmb994ahZhek2mgmZdnchbnnZb28jpdnZ8pfgih5Z76beighZ5qmcpqhZ4q0jto5Z4000001Z3aokq95Z2qhxjljZ2br45qcZ1z141z5)
�assertEqual�int�L�
ValueError�repr�sys�maxsizeZassertIsInstance�assertRaises�	TypeError)�self�s�v�sign�prefix�ssZvv�xrrr�
test_basic#s
zIntTestCases.test_basicc	s�tD]R�t�fdd�dD��r q|�t�d�t���|�t�d�t��dd�d��qtD],�t�fdd�dD��rxq\|�tt�d�q\|�tdd	�d
�|�td�d�|�td
�d�|�ttd�|�ttd�|�ttd�|�ttd�dS)Nc3s|]}|�vVqdS�Nr��.0Zch�Zlitrr�	<genexpr>��z0IntTestCases.test_underscores.<locals>.<genexpr>z.eEjJr�_rc3s|]}|�vVqdSrUrrVrXrrrY�rZZ1_00rr	Z0_100rs1_00Z_100z+_100Z1__00Z100_)	r�anyrDrE�eval�replacerrKrG�rMrrXr�test_underscores�s "zIntTestCases.test_underscorescCsD|�td�d�|�td�d�|�td�d�|�td�d�dS)Nr
rz-1r!s10s-1)�assertIsrEr_rrr�test_small_ints�szIntTestCases.test_small_intscCs|�t�d�dS)Nr�rDrEr_rrr�test_no_args�szIntTestCases.test_no_argscCs�|�tddd�d�|�td��tdd�Wd�n1s@0Y|�td��tddd�Wd�n1sx0Y|jttd	d�|jttd
d�dS)Nr
r"��baser'zkeyword argumentg333333�?)rS)rSrfrr)rDrE�assertRaisesRegexrLrKr_rrr�test_keyword_args�s(*zIntTestCases.test_keyword_argscCsR|�tdd�d�|�t��tdd�Wd�n1s<0Y|�t��tdd�Wd�n1sp0Y|�t��tdd�Wd�n1s�0Y|�t��$tdddd	d
�Wd�n1s�0Y|�t�� tddd	d
�Wd�n1�s0Ytdd�D]}|�td|d
�d��q2dS)z9Testing the supported limits of the int() base parameter.rr(rrN�%is���r"��re)rDrErKrG�range�rMrfrrr�test_int_base_limitss(((20z!IntTestCases.test_int_base_limitscCsl|�t��tdd�Wd�n1s*0Y|�t��tdd�Wd�n1s^0YdS)z2Not integer types are not valid bases; issue16772.rg@Ng@)rKrLrEr_rrr�test_int_base_bad_typess(z$IntTestCases.test_int_base_bad_typesc	Cs�Gdd�dt�}ddddddfD]8}|�t��td|�Wd�q&1sT0Yq&|�td|d�d	�d
�|�td|d�d	�d�|�td|d
�d	�d�dS)Nc@seZdZdd�Zdd�ZdS)z9IntTestCases.test_int_base_indexable.<locals>.MyIndexablecSs
||_dSrU��value)rMrprrr�__init__szBIntTestCases.test_int_base_indexable.<locals>.MyIndexable.__init__cSs|jSrUror_rrr�	__index__szCIntTestCases.test_int_base_indexable.<locals>.MyIndexable.__index__N)rrrrqrrrrrr�MyIndexablesrsr"rrriZ43Z101rer(r�erBi)�objectrKrGrErD)rMrsrfrrr�test_int_base_indexables*z$IntTestCases.test_int_base_indexablec
snGdd�dt��Gdd�dt�}Gdd�dt�}tt�fdd�||tg}zd	d
lm�WntyjYn0|��fdd��|D]�}|d�}|�t|����|�	t
|�d
�t|tttf�r�|�	t
|d�d�n<d}|�t
|��t
|d�Wd�n1�s0Y|�td��t
|d��Wd�n1�s>0YWd�q�1�s^0Yq�dS)Nc@seZdZdS)z<IntTestCases.test_non_numeric_input_types.<locals>.CustomStrNrrrrr�	CustomStr.rZrwc@seZdZdS)z>IntTestCases.test_non_numeric_input_types.<locals>.CustomBytesNrrrrr�CustomBytes/rZrxc@seZdZdS)zBIntTestCases.test_non_numeric_input_types.<locals>.CustomByteArrayNrrrrr�CustomByteArray0rZrycs�|���SrU)�decode��b)rwrr�<lambda>5rZz;IntTestCases.test_non_numeric_input_types.<locals>.<lambda>r��arraycs
�d|�S)N�Brr{r~rrr}?rZs100rr"r'zcan't convert non-stringzinvalid literalsAAAAAAAAAAAAAAAA)�str�bytes�	bytearray�
memoryviewr�ImportError�append�subTest�typerDrE�
isinstancergrLrG)rMrxryZ	factories�frS�msgr)rwrr�test_non_numeric_input_types+s4
�*z)IntTestCases.test_non_numeric_input_typescCs�|�ttd�dd��d�|�ttd�dd��d�|�ttd�dd��d�|�ttd�dd��d�|�ttd�dd��d�dS)	Ns123rrr5�123s123 s123As1234)rDrEr�r_rrr�test_int_memoryviewNs
z IntTestCases.test_int_memoryviewcCs|�ttd�dS)Nz1.2)rKrGrEr_rrr�test_string_floatUszIntTestCases.test_string_floatcsbGdd�d�}|�tt|��Gdd�dt�}|�tt|��Gdd�d�}|�t|��d�Gdd	�d	�}t|fD�]�}Gd
d�d|�}|�t|��d�Gdd
�d
|�}|�t|��d�Gdd�d|�}|�t��t|��Wd�n1s�0Yt|fD�]N}	Gdd�d|	��G�fdd�d|�}
|�t|
��d�Gdd�d|	��G�fdd�d|�}|�t|
��d�G�fdd�d|	��G�fdd�d|�}zt|��Wn6t�y�}
z|�t|
�d�WYd}
~
nd}
~
00|�d||	ff�Gdd�d|	��G�fd d!�d!|�}|�t��t|��Wd�n1�sN0Y�q
qtdS)"Nc@seZdZdS)z>IntTestCases.test_intconversion.<locals>.ClassicMissingMethodsNrrrrr�ClassicMissingMethodsZsr�c@seZdZdS)z7IntTestCases.test_intconversion.<locals>.MissingMethodsNrrrrr�MissingMethods^sr�c@seZdZdd�ZdS)z-IntTestCases.test_intconversion.<locals>.Foo0cSsdS�N�*rr_rrr�__int__csz5IntTestCases.test_intconversion.<locals>.Foo0.__int__N�rrrr�rrrr�Foo0bsr�r�c@seZdZdS)z0IntTestCases.test_intconversion.<locals>.ClassicNrrrrr�Classichsr�c@seZdZdd�Zdd�ZdS)z:IntTestCases.test_intconversion.<locals>.IntOverridesTrunccSsdSr�rr_rrrr�lszBIntTestCases.test_intconversion.<locals>.IntOverridesTrunc.__int__cSsdS)Ni�rr_rrr�	__trunc__nszDIntTestCases.test_intconversion.<locals>.IntOverridesTrunc.__trunc__N)rrrr�r�rrrr�IntOverridesTruncksr�c@seZdZdd�ZdS)z2IntTestCases.test_intconversion.<locals>.JustTrunccSsdSr�rr_rrrr�ssz<IntTestCases.test_intconversion.<locals>.JustTrunc.__trunc__N�rrrr�rrrr�	JustTruncrsr�c@seZdZdd�ZdS)z9IntTestCases.test_intconversion.<locals>.ExceptionalTrunccSsdddS)Nrrrr_rrrr�xszCIntTestCases.test_intconversion.<locals>.ExceptionalTrunc.__trunc__Nr�rrrr�ExceptionalTruncwsr�c@seZdZdd�ZdS)z.IntTestCases.test_intconversion.<locals>.IndexcSsdSr�rr_rrrrrsz8IntTestCases.test_intconversion.<locals>.Index.__index__N�rrrrrrrrr�Index~sr�cseZdZ�fdd�ZdS)z;IntTestCases.test_intconversion.<locals>.TruncReturnsNonIntcs��SrUrr_�r�rrr��szEIntTestCases.test_intconversion.<locals>.TruncReturnsNonInt.__trunc__Nr�rr�rr�TruncReturnsNonInt�sr�c@seZdZdd�ZdS)z0IntTestCases.test_intconversion.<locals>.IntablecSsdSr�rr_rrrr��sz8IntTestCases.test_intconversion.<locals>.Intable.__int__Nr�rrrr�Intable�sr�cseZdZ�fdd�ZdS)z=IntTestCases.test_intconversion.<locals>.TruncReturnsNonIndexcs��SrUrr_�r�rrr��szGIntTestCases.test_intconversion.<locals>.TruncReturnsNonIndex.__trunc__Nr�rr�rr�TruncReturnsNonIndex�sr�cseZdZ�fdd�ZdS)z4IntTestCases.test_intconversion.<locals>.NonIntegralcs��SrUrr_��NonIntegralrrr��sz>IntTestCases.test_intconversion.<locals>.NonIntegral.__trunc__Nr�rr�rrr��sr�cseZdZ�fdd�ZdS)z@IntTestCases.test_intconversion.<locals>.TruncReturnsNonIntegralcs��SrUrr_r�rrr��szJIntTestCases.test_intconversion.<locals>.TruncReturnsNonIntegral.__trunc__Nr�rr�rr�TruncReturnsNonIntegral�sr�z2__trunc__ returned non-Integral (type NonIntegral)z!Failed to raise TypeError with %sc@seZdZdd�ZdS)z/IntTestCases.test_intconversion.<locals>.BadIntcSsdS�NgE@rr_rrrr��sz7IntTestCases.test_intconversion.<locals>.BadInt.__int__Nr�rrrr�BadInt�sr�cseZdZ�fdd�ZdS)z;IntTestCases.test_intconversion.<locals>.TruncReturnsBadIntcs��SrUrr_�r�rrr��szEIntTestCases.test_intconversion.<locals>.TruncReturnsBadInt.__trunc__Nr�rr�rr�TruncReturnsBadInt�sr�)rKrLrErurD�ZeroDivisionErrorr�Zfail)rMr�r�r�r�rfr�r�r�Ztrunc_result_baser�r�r��er�r)r�r�r�r�r�test_intconversionXsJ(
��zIntTestCases.test_intconversioncCsZGdd�dt�}Gdd�dt�}|d�}|�|d�|�t|�d�|�t|��d�dS)Nc@seZdZdd�ZdS)z:IntTestCases.test_int_subclass_with_index.<locals>.MyIndexcSsdSr�rr_rrrrr�szDIntTestCases.test_int_subclass_with_index.<locals>.MyIndex.__index__Nr�rrrr�MyIndex�sr�c@seZdZdd�ZdS)z;IntTestCases.test_int_subclass_with_index.<locals>.BadIndexcSsdSr�rr_rrrrr�szEIntTestCases.test_int_subclass_with_index.<locals>.BadIndex.__index__Nr�rrrr�BadIndex�sr�r*r)rErD)rMr�r��my_intrrr�test_int_subclass_with_index�sz)IntTestCases.test_int_subclass_with_indexcCsjGdd�dt�}Gdd�dt�}|d�}|�|d�|�t|�d�|d�}|�|d�|�tt|�dS)Nc@seZdZdd�ZdS)z6IntTestCases.test_int_subclass_with_int.<locals>.MyIntcSsdSr�rr_rrrr��sz>IntTestCases.test_int_subclass_with_int.<locals>.MyInt.__int__Nr�rrrr�MyInt�sr�c@seZdZdd�ZdS)z7IntTestCases.test_int_subclass_with_int.<locals>.BadIntcSsdSr�rr_rrrr��sz?IntTestCases.test_int_subclass_with_int.<locals>.BadInt.__int__Nr�rrrrr��sr�r*r�)rErDrKrL)rMr�r�r�rrr�test_int_subclass_with_int�sz'IntTestCases.test_int_subclass_with_intc	s�Gdd�d��Gdd�dt�}Gdd�d��Gdd�dt�}G�fd	d
�d
�}G�fdd�d�}Gd
d�d�}��}|�t��t|�}Wd�n1s�0Y|�|d�|�t|�t�|�}t|�}|�|d�|�t|�t���}|�t��t|�}Wd�n1�s0Y|�|d�|�t|�t�|�}|�t��t|�}Wd�n1�sr0Y|�|d�|�t|�t�|�}|�t��t|�}Wd�n1�s�0Y|�|d�|�t|�t�|�}|�t��t|�}Wd�n1�s0Y|�|d�|�t|�t�|�}t|�}|�|d�|�t|�t�t|�}|�|d�|�t|�t�dS)Nc@seZdZdd�ZdS)z<IntTestCases.test_int_returns_int_subclass.<locals>.BadIndexcSsdS�NTrr_rrrrr�szFIntTestCases.test_int_returns_int_subclass.<locals>.BadIndex.__index__Nr�rrrrr��sr�c@seZdZdd�ZdS)z=IntTestCases.test_int_returns_int_subclass.<locals>.BadIndex2cSsdSr�rr_rrrrr�szGIntTestCases.test_int_returns_int_subclass.<locals>.BadIndex2.__index__Nr�rrrr�	BadIndex2�sr�c@seZdZdd�ZdS)z:IntTestCases.test_int_returns_int_subclass.<locals>.BadIntcSsdSr�rr_rrrr��szBIntTestCases.test_int_returns_int_subclass.<locals>.BadInt.__int__Nr�rrrrr��sr�c@seZdZdd�ZdS)z;IntTestCases.test_int_returns_int_subclass.<locals>.BadInt2cSsdSr�rr_rrrr��szCIntTestCases.test_int_returns_int_subclass.<locals>.BadInt2.__int__Nr�rrrr�BadInt2�sr�cseZdZ�fdd�ZdS)zHIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadIndexcs��SrUrr_�r�rrr��szRIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadIndex.__trunc__Nr�rr�rr�TruncReturnsBadIndex�sr�cseZdZ�fdd�ZdS)zFIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadIntcs��SrUrr_r�rrr��szPIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadInt.__trunc__Nr�rr�rrr��sr�c@seZdZdd�ZdS)zKIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsIntSubclasscSsdSr�rr_rrrr��szUIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsIntSubclass.__trunc__Nr�rrrr�TruncReturnsIntSubclass�sr�rr)rEZassertWarns�DeprecationWarningrDrar�r)	rMr�r�r�r�r�Zbad_int�nZgood_intr)r�r�r�test_int_returns_int_subclass�sV&((((z*IntTestCases.test_int_returns_int_subclasscs�d�fdd�	}|d�|d�|d�|d�|dd�|dd	�|dd
�|dd	�|dd
�|d�|dd�|d
�|d
d�|d�|dd�dS)Ncs~�jtd||fd��,}|dur*t|�n
t||�Wd�n1sH0Y��|jjdd|durndn||f�dS)Nzint(%r, %r))r�rz*invalid literal for int() with base %d: %rr)rKrGrErD�	exception�args)rNrf�cmr_rr�checks
�
(��z.IntTestCases.test_error_message.<locals>.check�½u123½z  123 456  z123rz123 245r2rz123245r�s123�u123�)Nr)rMr�rr_r�test_error_messages 






zIntTestCases.test_error_messagecCsL|�tdd�d�|�tdd�d�|�tdd�d	�|�td
d�d�dS)
NZ=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"iUUUUZ1_2_3_4_5_6_7_0_1_2_3r&iSp�SZ1_2_3_4_5_6_7_8_9rl�g�FZ
1_2_3_4_5_6_7r>i�2Drcr_rrr�test_issue316197s�zIntTestCases.test_issue31619N)rrrrTr`rZcpython_onlyrbrdrhrmrnrvr�r�r�r�r�r�r�r�r�rrrrr!s&8

#VH!rcs�eZdZeZ�fdd�Z�fdd�Zdd�Zdd�Zdd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Z�ZS)�IntStrDigitLimitsTestscs"t���t��|_t�d�dS)Ni)�super�setUprI�get_int_max_str_digits�_previous_limit�set_int_max_str_digitsr_��	__class__rrr�Cs

zIntStrDigitLimitsTests.setUpcst�|j�t���dSrU)rIr�r�r��tearDownr_r�rrr�HszIntStrDigitLimitsTests.tearDowncCs�|�t��d�|�t��d�t�d��6|�t��d�|�dd�}t|�Wd�n1sf0Y|�t��d�dS)Nri Nr)	Z
assertGreaterrIr��
assertLessr�adjust_int_max_str_digitsrD�	int_classr�)rM�irrr�test_disabled_limitLs&z*IntStrDigitLimitsTests.test_disabled_limitcCsz|j}t��}|d|�|dd|�|d|d�|dd|�|dd|�|�ttd|d��|�dS)z&Ignore the +/- sign and space padding.rrrrrrN)r�rIr�rD�lenr�)rMr��	maxdigitsrrr�test_max_str_digits_edge_casesUsz5IntStrDigitLimitsTests.test_max_str_digits_edge_casesNcCsN|�t��0|dur |�|�n|�||�Wd�n1s@0YdSrU)rKrGr�)rMr�rfrrrr�aszIntStrDigitLimitsTests.checkcCs�t��}|�d|d�|�dd|d�|�d|dd�|�dd|d�|�dd|d�|�d|d�d|}|�t��t|�Wd�n1s�0YdS)Nrrrrrr)rIr�r�rKrGr�)rMr�r�rrr�test_max_str_digitshsz*IntStrDigitLimitsTests.test_max_str_digitsc	Cs�t��}tj}|�dkrtj}tddd��dd�}d}t�|��|�}t|�}Wd�n1sf0Y|�|}|�	t
|�|�|d	kr�t�d
|�d���t�td|���R|�
t��}|�}t|�Wd�n1s�0Y|�|}	Wd�n1�s0Y|�d
t|j��|�|	|d�tddd��dd�}
|�
t��}|�}t|
�Wd�n1�s�0Y|�|}|�d
t|j��|�||d�dS)�?Regression test: ensure we fail before performing O(N**2) work.rr%�ci�rrei�1N��?�"slow" conversion took only �	 seconds.gףp=
��?�
conversionr"i �)rIr��time�process_time�	monotonicrErr�r�rDr��unittest�SkipTestrKrG�assertInr��assertLessEqualr�)rMr��get_timeZhuge_int�digits�startZhuge_decimal�seconds_to_convert�err�seconds_to_fail_hugeZextra_huge_int�seconds_to_fail_extra_hugerrr�+test_denial_of_service_prevented_int_to_strvs:
&
�
&*(
zBIntStrDigitLimitsTests.test_denial_of_service_prevented_int_to_strc	Cs�t��}tj}|�dkrtj}d}d|}t�|��|�}t|�Wd�n1sX0Y|�|}|dkr�t�	d|�d���t�|d��R|�
t��}|�}t|�Wd�n1s�0Y|�|}Wd�n1s�0Y|�d	t
|j��|�||d
�dd}	|�
t��}|�}t|	�Wd�n1�sP0Y|�|}
|�d	t
|j��|�|
|d
�dS)
r�riD
�8Nr�r�r�rr�r"�7i�O)rIr�r�r�r�rr�rEr�r�rKrGr�r�r�r�)rMr�r�r�Zhuger�r�r�r�Z
extra_huger�rrr�+test_denial_of_service_prevented_str_to_int�s8
&
�
&((
zBIntStrDigitLimitsTests.test_denial_of_service_prevented_str_to_intc	Csft��}dD]T}|j|d��4|�d|d|�|�dd|�Wd�q1sV0YqdS)z-The limit does not apply to power of 2 bases.)r"r'r&rr>rerri��N)rIr�r�r�)rMr�rfrrr�!test_power_of_two_bases_unlimited�s
z8IntStrDigitLimitsTests.test_power_of_two_bases_unlimitedcCsXt��}|d}d|}d|}|�|�|�|�|�|�d��|�|�d��dS)NrZ111Z1_11Z_111)rIr�r�r�)rMr�ZtriplesrNZs_rrr�test_underscores_ignored�s

z/IntStrDigitLimitsTests.test_underscores_ignoredcCsN|j}t��}d|}||�}|d|���}|d|���}t|�t|�dS)N�5rr)r�rIr�r�)rMr��
max_digitsrNr�Zpos_iZneg_irrr�test_sign_not_counted�sz,IntStrDigitLimitsTests.test_sign_not_countedcCs�|j}t��}d|}|||�}|dkr\|�t��t|�Wd�ql1sP0Yn|dkrlt|�|�t�� }||�d�|�Wd�n1s�0YdS)N�2rr)r�rIr�rKrGr�)rMrfr�r�rNr�r�rrr�_other_base_helper�s
(z)IntStrDigitLimitsTests._other_base_helpercCsxd}|j|d��|�|�Wd�n1s00Yd}|j|d��|�|�Wd�n1sj0YdS)NrrerB)r�r�rlrrr�test_int_from_other_bases�s(z0IntStrDigitLimitsTests.test_int_from_other_bases)N)rrrrEr�r�r�r�r�r�r�r�r�r�r�r�r�r��
__classcell__rrr�rr�?s	
+(

r�c@seZdZeZdS)�IntSubclassStrDigitLimitsTestsN)rrrrr�rrrrr�sr��__main__)rIr�r��testrZtest.test_grammarrrrHrJrGrFrErZTestCaserr�r�r�mainrrrr�<module>sD�"B

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