HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/test_int.cpython-37.pyc
B

��g@M�@s�ddlZddlZddlmZddlmZmZdddddd	d
ddd
eej�ejfde	fdde	fde	fde	fde	fde	fgZ
Gdd�de�ZGdd�dej
�Zedkr�e��dS)�N)�support)�VALID_UNDERSCORE_LITERALS�INVALID_UNDERSCORE_LITERALS)�0r)�1�)�9�	)�10�
)Z99�c)�100�d)Z314i:)z 314i:)z314 i:)z  		  314  		  i:z  1x)z  1  rz  1  �� z  		  uȀc@seZdZdS)�IntSubclassN)�__name__�
__module__�__qualname__�rr�)/usr/local/lib/python3.7/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!S)"�IntTestCasescCsT	|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td	�d�|�td
�d�|�td�d�|�td�d�|�td
d�d�x~tD]v\}}xldD]d}x^dD]V}|||}|}|dkr�|tk	r�|}y|�t|�|�Wq�tk
�r$Yq�Xq�Wq�Wq�Wtdtj�}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)�Ni:g��Q�	@�g��Q�	����g333333@g333333�g@g�z-3z -3 u -3 r
�)r�+�-)rr�	z  		  r���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	sxZtD]R�t�fdd�dD��r"q|�t�d�t���|�t�d�t��dd�d��qWx4tD],�t�fdd�dD��r~qb|�tt�d�qbW|�tdd	�d
�|�td�d�|�td
�d�|�ttd�|�ttd�|�ttd�|�ttd�dS)Nc3s|]}|�kVqdS)Nr)�.0�ch)�litrr�	<genexpr>�sz0IntTestCases.test_underscores.<locals>.<genexpr>z.eEjJr�_rc3s|]}|�kVqdS)Nr)rRrS)rTrrrU�sZ1_00rr	Z0_100rs1_00Z_100z+_100Z1__00Z100_)	r�anyrArB�eval�replacerrHrD)rJr)rTr�test_underscores�s 
$
zIntTestCases.test_underscorescCsD|�td�d�|�td�d�|�td�d�|�td�d�dS)Nr
rz-1rs10s-1)�assertIsrB)rJrrr�test_small_ints�szIntTestCases.test_small_intscCs|�t�d�dS)Nr)rArB)rJrrr�test_no_args�szIntTestCases.test_no_argsc	Cs~|�tddd�d�|�td��tdd�WdQRX|�td��tddd�WdQRX|jttd	d�|jttd
d�dS)Nr
r)�baser$zkeyword argumentg333333�?)rP)rPr^rr)rArB�assertRaisesRegexrIrH)rJrrr�test_keyword_args�szIntTestCases.test_keyword_argsc	Cs�|�tdd�d�|�t��tdd�WdQRX|�t��tdd�WdQRX|�t��tdd�WdQRX|�t��tdddd	d
�WdQRX|�t��tddd	d
�WdQRXx&tdd�D]}|�td|d
�d�q�WdS)z9Testing the supported limits of the int() base parameter.rr%rrN�%is���r��)r^)rArBrHrD�range)rJr^rrr�test_int_base_limitssz!IntTestCases.test_int_base_limitsc	CsD|�t��tdd�WdQRX|�t��tdd�WdQRXdS)z2Not integer types are not valid bases; issue16772.rg@Ng@)rHrIrB)rJrrr�test_int_base_bad_typessz$IntTestCases.test_int_base_bad_typesc
Cs�Gdd�dt�}x>ddddddfD]$}|�t��td|�WdQRXq(W|�td|d�d	�d
�|�td|d�d	�d�|�td|d
�d	�d�dS)Nc@seZdZdd�Zdd�ZdS)z9IntTestCases.test_int_base_indexable.<locals>.MyIndexablecSs
||_dS)N)�value)rJrfrrr�__init__szBIntTestCases.test_int_base_indexable.<locals>.MyIndexable.__init__cSs|jS)N)rf)rJrrr�	__index__szCIntTestCases.test_int_base_indexable.<locals>.MyIndexable.__index__N)rrrrgrhrrrr�MyIndexablesrirrrraZ43Z101)r^r%r�er?i)�objectrHrDrBrA)rJrir^rrr�test_int_base_indexablesz$IntTestCases.test_int_base_indexablecs2Gdd�dt��Gdd�dt�}Gdd�dt�}tt�fdd�||tg}yd	d
lm�Wntk
rlYnX|��fdd��x�|D]�}|d�}|�t|����|�	t
|�d
�t|tttf�r�|�	t
|d�d�n&d}|�t
|��t
|d�WdQRX|�td��t
|d��WdQRXWdQRXq�WdS)Nc@seZdZdS)z<IntTestCases.test_non_numeric_input_types.<locals>.CustomStrN)rrrrrrr�	CustomStr-srmc@seZdZdS)z>IntTestCases.test_non_numeric_input_types.<locals>.CustomBytesN)rrrrrrr�CustomBytes.srnc@seZdZdS)zBIntTestCases.test_non_numeric_input_types.<locals>.CustomByteArrayN)rrrrrrr�CustomByteArray/srocs�|���S)N)�decode)�b)rmrr�<lambda>4�z;IntTestCases.test_non_numeric_input_types.<locals>.<lambda>r)�arraycs
�d|�S)N�Br)rq)rtrrrr>rss100rrr$zcan't convert non-stringzinvalid literalsAAAAAAAAAAAAAAAA)�str�bytes�	bytearray�
memoryviewrt�ImportError�appendZsubTest�typerArB�
isinstancer_rIrD)rJrnroZ	factories�frP�msgr)rmrtr�test_non_numeric_input_types*s2

z)IntTestCases.test_non_numeric_input_typescCs�|�ttd�dd��d�|�ttd�dd��d�|�ttd�dd��d�|�ttd�dd��d�|�ttd�dd��d�dS)	Ns123rrr2s123s123 s123As1234)rArBry)rJrrr�test_int_memoryviewMs
z IntTestCases.test_int_memoryviewcCs|�ttd�dS)Nz1.2)rHrDrB)rJrrr�test_string_floatTszIntTestCases.test_string_floatcsGdd�d�}|�tt|��Gdd�dt�}|�tt|��Gdd�d�}|�t|��d�Gdd	�d	�}�x�t|fD�]�}Gd
d�d|�}|�t|��d�Gdd
�d
|�}|�t|��d�Gdd�d|�}|�t��t|��WdQRX�x
t|fD]�}	Gdd�d|	��G�fdd�d|�}
|�t|
��d�G�fdd�d|	��G�fdd�d|�}yt|��Wn4tk
�r�}z|�t|�d�Wdd}~XYnX|�d||	ff�Gdd�d|	��G�fdd�d|�}
|�t��t|
��WdQRXq�WqxWdS)Nc@seZdZdS)z>IntTestCases.test_intconversion.<locals>.ClassicMissingMethodsN)rrrrrrr�ClassicMissingMethodsYsr�c@seZdZdS)z7IntTestCases.test_intconversion.<locals>.MissingMethodsN)rrrrrrr�MissingMethods]sr�c@seZdZdd�ZdS)z-IntTestCases.test_intconversion.<locals>.Foo0cSsdS)N�*r)rJrrr�__int__bsz5IntTestCases.test_intconversion.<locals>.Foo0.__int__N)rrrr�rrrr�Foo0asr�r�c@seZdZdS)z0IntTestCases.test_intconversion.<locals>.ClassicN)rrrrrrr�Classicgsr�c@seZdZdd�Zdd�ZdS)z:IntTestCases.test_intconversion.<locals>.IntOverridesTrunccSsdS)Nr�r)rJrrrr�kszBIntTestCases.test_intconversion.<locals>.IntOverridesTrunc.__int__cSsdS)Ni�r)rJrrr�	__trunc__mszDIntTestCases.test_intconversion.<locals>.IntOverridesTrunc.__trunc__N)rrrr�r�rrrr�IntOverridesTruncjsr�c@seZdZdd�ZdS)z2IntTestCases.test_intconversion.<locals>.JustTrunccSsdS)Nr�r)rJrrrr�rsz<IntTestCases.test_intconversion.<locals>.JustTrunc.__trunc__N)rrrr�rrrr�	JustTruncqsr�c@seZdZdd�ZdS)z9IntTestCases.test_intconversion.<locals>.ExceptionalTrunccSsdddS)Nrrr)rJrrrr�wszCIntTestCases.test_intconversion.<locals>.ExceptionalTrunc.__trunc__N)rrrr�rrrr�ExceptionalTruncvsr�c@seZdZdd�ZdS)z1IntTestCases.test_intconversion.<locals>.IntegralcSsdS)Nr�r)rJrrrr�~sz9IntTestCases.test_intconversion.<locals>.Integral.__int__N)rrrr�rrrr�Integral}sr�cseZdZ�fdd�ZdS)z;IntTestCases.test_intconversion.<locals>.TruncReturnsNonIntcs��S)Nr)rJ)r�rrr��szEIntTestCases.test_intconversion.<locals>.TruncReturnsNonInt.__trunc__N)rrrr�r)r�rr�TruncReturnsNonInt�sr�cseZdZ�fdd�ZdS)z4IntTestCases.test_intconversion.<locals>.NonIntegralcs��S)Nr)rJ)�NonIntegralrrr��sz>IntTestCases.test_intconversion.<locals>.NonIntegral.__trunc__N)rrrr�r)r�rrr��sr�cseZdZ�fdd�ZdS)z@IntTestCases.test_intconversion.<locals>.TruncReturnsNonIntegralcs��S)Nr)rJ)r�rrr��szJIntTestCases.test_intconversion.<locals>.TruncReturnsNonIntegral.__trunc__N)rrrr�r)r�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@r)rJrrrr��sz7IntTestCases.test_intconversion.<locals>.BadInt.__int__N)rrrr�rrrr�BadInt�sr�cseZdZ�fdd�ZdS)z;IntTestCases.test_intconversion.<locals>.TruncReturnsBadIntcs��S)Nr)rJ)r�rrr��szEIntTestCases.test_intconversion.<locals>.TruncReturnsBadInt.__trunc__N)rrrr�r)r�rr�TruncReturnsBadInt�sr�)rHrIrBrkrA�ZeroDivisionErrorrvZfail)rJr�r�r�r�r^r�r�r�Ztrunc_result_baser�r��er�r)r�r�r�r�test_intconversionWs@
zIntTestCases.test_intconversioncCsXGdd�dt�}Gdd�dt�}|d�}|�|d�|�t|�d�|�tt|��dS)Nc@seZdZdd�ZdS)z6IntTestCases.test_int_subclass_with_int.<locals>.MyIntcSsdS)Nr�r)rJrrrr��sz>IntTestCases.test_int_subclass_with_int.<locals>.MyInt.__int__N)rrrr�rrrr�MyInt�sr�c@seZdZdd�ZdS)z7IntTestCases.test_int_subclass_with_int.<locals>.BadIntcSsdS)NgE@r)rJrrrr��sz?IntTestCases.test_int_subclass_with_int.<locals>.BadInt.__int__N)rrrr�rrrrr��sr�r'r�)rBrArHrI)rJr�r�Zmy_intrrr�test_int_subclass_with_int�sz'IntTestCases.test_int_subclass_with_intc	sPGdd�d��Gdd�dt�}G�fdd�d�}Gdd�d�}��}|�t��t|�}WdQRX|�|d	�|�t|�t�|�}|�t��t|�}WdQRX|�|d	�|�t|�t�|�}|�t��t|�}WdQRX|�|d	�|�t|�t�|�}t|�}|�|d	�|�t|�t�t|�}|�|d	�|�t|�t�dS)
Nc@seZdZdd�ZdS)z:IntTestCases.test_int_returns_int_subclass.<locals>.BadIntcSsdS)NTr)rJrrrr��szBIntTestCases.test_int_returns_int_subclass.<locals>.BadInt.__int__N)rrrr�rrrrr��sr�c@seZdZdd�ZdS)z;IntTestCases.test_int_returns_int_subclass.<locals>.BadInt2cSsdS)NTr)rJrrrr��szCIntTestCases.test_int_returns_int_subclass.<locals>.BadInt2.__int__N)rrrr�rrrr�BadInt2�sr�cseZdZ�fdd�ZdS)zFIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadIntcs��S)Nr)rJ)r�rrr��szPIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadInt.__trunc__N)rrrr�r)r�rrr��sr�c@seZdZdd�ZdS)zKIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsIntSubclasscSsdS)NTr)rJrrrr��szUIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsIntSubclass.__trunc__N)rrrr�rrrr�TruncReturnsIntSubclass�sr�r)rBZassertWarns�DeprecationWarningrAr[r|r)rJr�r�r�Zbad_int�nZgood_intr)r�r�test_int_returns_int_subclass�s4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)Nc	sj�jtd||fd��"}|dkr*t|�n
t||�WdQRX��|jjdd|dkrZdn||f�dS)Nzint(%r, %r))rrz*invalid literal for int() with base %d: %rr)rHrDrBrAZ	exception�args)rKr^�cm)rJrr�check�s
z.IntTestCases.test_error_message.<locals>.check�½u123½z  123 456  z123rz123 245r/rz123245s123s123�u123�)Nr)rJr�r)rJr�test_error_message�s 






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_1riUUUUZ1_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�2D)rArB)rJrrr�test_issue31619�s
zIntTestCases.test_issue31619N)rrrrQrZrZcpython_onlyr\r]r`rdrerlr�r�r�r�r�r�r�r�rrrrr s"8
#M+!r�__main__)rFZunittestZtestrZtest.test_grammarrrrErGrDrCrBrZTestCaserr�mainrrrr�<module>s8
j