add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
U

��_4Sc@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)Z1�)Z9�	)�10�
)Z99ic)�100�d)Z314�:)z 314r)z314 r)z  		  314  		  rz  1x)z  1  rz  1  �� �  		  uȀc@�eZdZdS)�IntSubclassN��__name__�
__module__�__qualname__�rr�%/usr/lib64/python3.8/test/test_int.pyr�rc@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)$�IntTestCasescCsH	|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td	�d�|�td
�d�|�td�d�|�td�d�|�td
d�d�tD]n\}}dD]`}dD]V}|||}|}|dkr�|tk	r�|}z|�t|�|�Wq�tk
�rYq�Xq�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�	�i����g333333@g333333�g@g�z-3z -3 u -3 r�)rz+�-)rr
z	rr�����rg}Ô%�I�Tg}Ô%�I���AX111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111iZ0o123riSZ0x123i#Z0xZ0o�Z0bZ!100000000000000000000000000000000lZ102002022201221111211Z10000000000000000�Z32244002423141�Z
1550104015504iZ211301422354�Z40000000000Z12068657454rZ
4294967296rZ
1904440554iZ	9ba461594Z	535a79889i
Z	2ca5b7464iZ	1a20dcd81iZ	100000000Za7ffda91iZ704he7g4iZ4f5aff66iZ3723ai4g�Z281d55i4iZ1fj8b184iZ1606k7ic�Zmb994agiZhek2mgliZdnchbnmiZb28jpdmiZ8pfgih4iZ76beiggiZ5qmcpqgiZ4q0jto4iZ4000000� Z3aokq94i!Z2qhxjlii"Z2br45qbi#Z1z141z4�$z 0o123  Z000Z0b100z	 0O123   z 0X123  z 0B100 Z0123i{Z0X123Z0O123Z0B100Z0b2Z0b02Z0B2Z0B02Z0o8Z0o08Z0O8Z0O08Z0xgZ0x0gZ0XgZ0X0gZ!100000000000000000000000000000001lZ102002022201221111212Z10000000000000001Z32244002423142Z
1550104015505Z211301422355Z40000000001Z12068657455Z
4294967297Z
1904440555Z	9ba461595Z	535a7988aZ	2ca5b7465Z	1a20dcd82Z	100000001Za7ffda92Z704he7g5Z4f5aff67Z3723ai4hZ281d55i5Z1fj8b185Z1606k7idZmb994ahZhek2mgmZdnchbnnZb28jpdnZ8pfgih5Z76beighZ5qmcpqhZ4q0jto5Z4000001Z3aokq95Z2qhxjljZ2br45qcZ1z141z5)
�assertEqual�int�L�
ValueError�repr�sys�maxsizeZassertIsInstance�assertRaises�	TypeError)�self�sZvZsignZprefixZssZvv�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)Nc3�|]}|�kVqdS�Nr�Z.0Zch�Zlitrr�	<genexpr>��z0IntTestCases.test_underscores.<locals>.<genexpr>z.eEjJrZ_rc3r3r4rr5r6rrr7�r8Z1_00rrZ0_100r
s1_00Z_100z+_100Z1__00Z100_)	rZanyr&r'ZevalZreplacerr-r)�r/rr6r�test_underscores�s "zIntTestCases.test_underscorescCsD|�td�d�|�td�d�|�td�d�|�td�d�dS)Nrrz-1rs10s-1)�assertIsr'r9rrr�test_small_ints�szIntTestCases.test_small_intscCs|�t�d�dS)Nr�r&r'r9rrr�test_no_args��zIntTestCases.test_no_argsc	Cs~|�tddd�d�|�td��tdd�W5QRX|�td��tddd�W5QRX|jttd	d�|jttd
d�dS)Nr	r��baserzkeyword argumentg333333�?)r1)r1rArr)r&r'�assertRaisesRegexr.r-r9rrr�test_keyword_args�szIntTestCases.test_keyword_argsc	Cs�|�tdd�d�|�t��tdd�W5QRX|�t��tdd�W5QRX|�t��tdd�W5QRX|�t��tddddd	�W5QRX|�t��tdddd	�W5QRXtdd�D]}|�td|d	�d�q�d
S)z9Testing the supported limits of the int() base parameter.rr rr�%is���ri�r@N)r&r'r-r)Zrange)r/rArrr�test_int_base_limitssz!IntTestCases.test_int_base_limitsc	CsD|�t��tdd�W5QRX|�t��tdd�W5QRXdS)z2Not integer types are not valid bases; issue16772.rg@g@N)r-r.r'r9rrr�test_int_base_bad_typessz$IntTestCases.test_int_base_bad_typesc
Cs�Gdd�dt�}ddddddfD]$}|�t��td|�W5QRXq&|�td|d�d	�d
�|�td|d�d	�d�|�td|d
�d	�d�dS)Nc@�eZdZdd�Zdd�ZdS)z9IntTestCases.test_int_base_indexable.<locals>.MyIndexablecSs
||_dSr4��value)r/rIrrr�__init__r?zBIntTestCases.test_int_base_indexable.<locals>.MyIndexable.__init__cSs|jSr4rHr9rrr�	__index__r?zCIntTestCases.test_int_base_indexable.<locals>.MyIndexable.__index__N)rrrrJrKrrrr�MyIndexable�rLrr
rrDZ43Z101r@r rier%i)�objectr-r)r'r&)r/rLrArrr�test_int_base_indexablesz$IntTestCases.test_int_base_indexablecs.Gdd�dt��Gdd�dt�}Gdd�dt�}tt�fdd�||tg}zd	d
lm�Wntk
rlYnX|��fdd��|D]�}|d�}|�t|����|�	t
|�d
�t|tttf�r�|�	t
|d�d�n&d}|�t
|��t
|d�W5QRX|�td��t
|d��W5QRXW5QRXq�dS)Nc@r)z<IntTestCases.test_non_numeric_input_types.<locals>.CustomStrNrrrrr�	CustomStr-�rPc@r)z>IntTestCases.test_non_numeric_input_types.<locals>.CustomBytesNrrrrr�CustomBytes.rQrRc@r)zBIntTestCases.test_non_numeric_input_types.<locals>.CustomByteArrayNrrrrr�CustomByteArray/rQrScs�|���Sr4)Zdecode�Zb)rPrr�<lambda>4�z;IntTestCases.test_non_numeric_input_types.<locals>.<lambda>r��arraycs
�d|�S)NZBrrTrWrrrU>rVs100r
rrzcan't convert non-stringzinvalid literalsAAAAAAAAAAAAAAAA)�strZbytesZ	bytearray�
memoryviewrXZImportErrorZappendZsubTest�typer&r'Z
isinstancerBr.r))r/rRrSZ	factoriesZfr1�msgr)rPrXr�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)	Ns123rrr#�123s123 s123As1234)r&r'rZr9rrr�test_int_memoryviewMs
z IntTestCases.test_int_memoryviewcCs|�ttd�dS)Nz1.2)r-r)r'r9rrr�test_string_floatTr?zIntTestCases.test_string_floatcs4Gdd�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|��W5QRXt|fD�]4}	Gdd�d|	��G�fdd�d|�}
|�t|
��d�Gdd�d|	��G�fdd�d|�}|�t|
��d�G�fdd�d|	��G�fdd�d|�}zt|��Wn4tk
�r�}
z|�t|
�d�W5d}
~
XYnX|�d||	ff�Gdd�d|	��G�fd d!�d!|�}|�t��t|��W5QRXq�qtdS)"Nc@r)z>IntTestCases.test_intconversion.<locals>.ClassicMissingMethodsNrrrrr�ClassicMissingMethodsYrrac@r)z7IntTestCases.test_intconversion.<locals>.MissingMethodsNrrrrr�MissingMethods]rrbc@�eZdZdd�ZdS)z-IntTestCases.test_intconversion.<locals>.Foo0cS�dS�N�*rr9rrr�__int__br?z5IntTestCases.test_intconversion.<locals>.Foo0.__int__N�rrrrgrrrr�Foo0arrirfc@r)z0IntTestCases.test_intconversion.<locals>.ClassicNrrrrr�Classicgrrjc@rG)z:IntTestCases.test_intconversion.<locals>.IntOverridesTrunccSrdrerr9rrrrgkr?zBIntTestCases.test_intconversion.<locals>.IntOverridesTrunc.__int__cSrd)Ni����rr9rrr�	__trunc__mr?zDIntTestCases.test_intconversion.<locals>.IntOverridesTrunc.__trunc__N)rrrrgrkrrrr�IntOverridesTruncjrMrlc@rc)z2IntTestCases.test_intconversion.<locals>.JustTrunccSrdrerr9rrrrkrr?z<IntTestCases.test_intconversion.<locals>.JustTrunc.__trunc__N�rrrrkrrrr�	JustTruncqrrnc@rc)z9IntTestCases.test_intconversion.<locals>.ExceptionalTrunccSsdddS)Nrrrr9rrrrkwr?zCIntTestCases.test_intconversion.<locals>.ExceptionalTrunc.__trunc__Nrmrrrr�ExceptionalTruncvrroc@rc)z.IntTestCases.test_intconversion.<locals>.IndexcSrdrerr9rrrrK~r?z8IntTestCases.test_intconversion.<locals>.Index.__index__N�rrrrKrrrr�Index}rrqc�eZdZ�fdd�ZdS)z;IntTestCases.test_intconversion.<locals>.TruncReturnsNonIntc���Sr4rr9�rqrrrk�r?zEIntTestCases.test_intconversion.<locals>.TruncReturnsNonInt.__trunc__Nrmrrtrr�TruncReturnsNonInt�rruc@rc)z0IntTestCases.test_intconversion.<locals>.IntablecSrdrerr9rrrrg�r?z8IntTestCases.test_intconversion.<locals>.Intable.__int__Nrhrrrr�Intable�rrvcrr)z=IntTestCases.test_intconversion.<locals>.TruncReturnsNonIndexcrsr4rr9�rvrrrk�r?zGIntTestCases.test_intconversion.<locals>.TruncReturnsNonIndex.__trunc__Nrmrrwrr�TruncReturnsNonIndex�rrxcrr)z4IntTestCases.test_intconversion.<locals>.NonIntegralcrsr4rr9��NonIntegralrrrk�sz>IntTestCases.test_intconversion.<locals>.NonIntegral.__trunc__Nrmrryrrrz�rrzcrr)z@IntTestCases.test_intconversion.<locals>.TruncReturnsNonIntegralcrsr4rr9ryrrrk�r?zJIntTestCases.test_intconversion.<locals>.TruncReturnsNonIntegral.__trunc__Nrmrryrr�TruncReturnsNonIntegral�rr{z2__trunc__ returned non-Integral (type NonIntegral)z!Failed to raise TypeError with %sc@rc)z/IntTestCases.test_intconversion.<locals>.BadIntcSrd�NgE@rr9rrrrg�r?z7IntTestCases.test_intconversion.<locals>.BadInt.__int__Nrhrrrr�BadInt�rr}crr)z;IntTestCases.test_intconversion.<locals>.TruncReturnsBadIntcrsr4rr9�r}rrrk�r?zEIntTestCases.test_intconversion.<locals>.TruncReturnsBadInt.__trunc__Nrmrr~rr�TruncReturnsBadInt�rr)r-r.r'rNr&ZZeroDivisionErrorrYZfail)r/rarbrirjrArlrnroZtrunc_result_baserurxr{Zerr)r}rqrvrzr�test_intconversionWsJ
��zIntTestCases.test_intconversioncCsZGdd�dt�}Gdd�dt�}|d�}|�|d�|�t|�d�|�t|��d�dS)Nc@rc)z:IntTestCases.test_int_subclass_with_index.<locals>.MyIndexcSrdrerr9rrrrK�r?zDIntTestCases.test_int_subclass_with_index.<locals>.MyIndex.__index__Nrprrrr�MyIndex�rr�c@rc)z;IntTestCases.test_int_subclass_with_index.<locals>.BadIndexcSrdr|rr9rrrrK�r?zEIntTestCases.test_int_subclass_with_index.<locals>.BadIndex.__index__Nrprrrr�BadIndex�rr�r!r)r'r&)r/r�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@rc)z6IntTestCases.test_int_subclass_with_int.<locals>.MyIntcSrdrerr9rrrrg�r?z>IntTestCases.test_int_subclass_with_int.<locals>.MyInt.__int__Nrhrrrr�MyInt�rr�c@rc)z7IntTestCases.test_int_subclass_with_int.<locals>.BadIntcSrdr|rr9rrrrg�r?z?IntTestCases.test_int_subclass_with_int.<locals>.BadInt.__int__Nrhrrrrr}�rr}r!rf)r'r&r-r.)r/r�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|�}W5QRX|�|d�|�t|�t�|�}t|�}|�|d�|�t|�t���}|�t��t|�}W5QRX|�|d�|�t|�t�|�}|�t��t|�}W5QRX|�|d�|�t|�t�|�}|�t��t|�}W5QRX|�|d�|�t|�t�|�}|�t��t|�}W5QRX|�|d�|�t|�t�|�}t|�}|�|d�|�t|�t�t|�}|�|d�|�t|�t�dS)Nc@rc)z<IntTestCases.test_int_returns_int_subclass.<locals>.BadIndexcSrd�NTrr9rrrrK�r?zFIntTestCases.test_int_returns_int_subclass.<locals>.BadIndex.__index__Nrprrrrr��rr�c@rc)z=IntTestCases.test_int_returns_int_subclass.<locals>.BadIndex2cSrdr�rr9rrrrK�r?zGIntTestCases.test_int_returns_int_subclass.<locals>.BadIndex2.__index__Nrprrrr�	BadIndex2�rr�c@rc)z:IntTestCases.test_int_returns_int_subclass.<locals>.BadIntcSrdr�rr9rrrrg�r?zBIntTestCases.test_int_returns_int_subclass.<locals>.BadInt.__int__Nrhrrrrr}�rr}c@rc)z;IntTestCases.test_int_returns_int_subclass.<locals>.BadInt2cSrdr�rr9rrrrg�r?zCIntTestCases.test_int_returns_int_subclass.<locals>.BadInt2.__int__Nrhrrrr�BadInt2�rr�crr)zHIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadIndexcrsr4rr9�r�rrrk�r?zRIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadIndex.__trunc__Nrmrr�rr�TruncReturnsBadIndex�rr�crr)zFIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadIntcrsr4rr9r~rrrk�r?zPIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadInt.__trunc__Nrmrr~rrr�rrc@rc)zKIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsIntSubclasscSrdr�rr9rrrrk�r?zUIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsIntSubclass.__trunc__Nrmrrrr�TruncReturnsIntSubclass�rr�rr)r'ZassertWarnsZDeprecationWarningr&r;r[r)	r/r�r�r�rr�Zbad_intZnZgood_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)Nc	sj�jtd||fd��"}|dkr*t|�n
t||�W5QRX��|jjdd|dkrZdn||f�dS)Nzint(%r, %r))r\rz*invalid literal for int() with base %d: %rr)r-r)r'r&Z	exceptionZargs)r0rAZcmr9rr�checks
�
��z.IntTestCases.test_error_message.<locals>.checku½u123½z  123 456  z123rz123 245r"rz123245r^s123�u123���r4r)r/r�rr9r�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_1riUUUUZ1_2_3_4_5_6_7_0_1_2_3riSp�SZ1_2_3_4_5_6_7_8_9rl�g�FZ
1_2_3_4_5_6_7r$i�2Dr=r9rrr�test_issue316196s�zIntTestCases.test_issue31619N)rrrr2r:rZcpython_onlyr<r>rCrErFrOr]r_r`r�r�r�r�r�r�rrrrr s&8

#VH!rZ__main__)r+ZunittestZtestrZtest.test_grammarrrr*r,r)r(r'rZTestCaserrZmainrrrrZ<module>s<�"