Your IP : 216.73.217.32


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_int.cpython-35.opt-2.pyc



���]�F�@s%ddlZddlZddlmZddfddfddfdd	fd
dfdd
fddfddfddfddfeej�ejfdefddfdefdefdefdefdefgZGdd�de�Z	Gdd�dej
�Zedkr!ej
�dS)�N)�support�0�1��9�	�10�
Z99�c�100�dZ314i:z 314z314 z  		  314  		  z  1xz  1  z  1  �� z  		  uȀc@seZdZdS)�IntSubclassN)�__name__�
__module__�__qualname__�rr�-/opt/alt/python35/lib64/python3.5/test_int.pyrsrc@s�eZdZdd�Zejdd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)�IntTestCasescCs�|jtd�d�|jtd�d�|jtd��d��|jtd�d�|jtd��d��|jtd�d�|jtd��d��|jtd�d��|jtd�d��|jtd�d��|jtd	d
�d
�x�tD]�\}}x�d�D]y}xpd�D]h}|||}|}|d
krU|tk	rU|}y|jt|�|�Wqtk
r�YqXqWqWq�Wtd�tj�}t|�}|j|dtj�|j|t�|jt|dd��tjd�td�}|j|t�td��}|j|t�d�tj}|j|d?|d�tdd�}|j|t�|jt	tdd�|jtdd�d�|jtdd
�d�|jttdd
�|jttdd�|jttdd�|jttdd�|jttdd�|jttdd�|jtd d�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!�|jtd2d�d!�|jtd3d4�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!�|jtdbd�d�|jtdbd�d�|jtdcd�d�|jtdd�d�|jtdd�d�|jtddd�d$�|jtded�d�|jtdfd�d�|jtdgd�d$�|jtdh�di�|jtdhd/�di�|jtdd
�d�|jtdd�d�|jtddd�d$�|jtdjd
�d�|jtdkd�d�|jtdld�d$�|jttdmd�|jttdnd�|jttdod�|jttdpd�|jttdqd�|jttdrd�|jttdsd�|jttdtd�|jttdud
�|jttdvd
�|jttdwd
�|jttdxd
�|jtdyd�dz�|jtd{d�dz�|jtd|d$�dz�|jtd}d&�dz�|jtd~d(�dz�|jtdd*�dz�|jtd�d�dz�|jtd�d-�dz�|jtd�d/�dz�|jtd�d1�dz�|jtd�d�dz�|jtd�d4�dz�|jtd�d6�dz�|jtd�d8�dz�|jtd�d
�dz�|jtd�d;�dz�|jtd�d=�dz�|jtd�d?�dz�|jtd�dA�dz�|jtd�dC�dz�|jtd�dE�dz�|jtd�dG�dz�|jtd�dI�dz�|jtd�dK�dz�|jtd�dM�dz�|jtd�dO�dz�|jtd�dQ�dz�|jtd�dS�dz�|jtd�dU�dz�|jtd�dW�dz�|jtd�dY�dz�|jtd�d[�dz�|jtd�d]�dz�|jtd�d_�dz�|jtd�da�dz�dS)�Ni:g��Q�	@�g333333@g@z-3z -3 u -3 r�r
�+�-r�	�  		  rg}Ô%�I�T�riX�Z0o123r�SZ0x123i#�0xZ0o�Z0bZ!100000000000000000000000000000000lZ102002022201221111211Z10000000000000000�Z32244002423141�Z
1550104015504�Z211301422354�Z40000000000Z12068657454rZ
4294967296r	Z
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	100000001Za7ffda92Z704he7g5Z4f5aff67Z3723ai4hZ281d55i5Z1fj8b185Z1606k7idZmb994ahZhek2mgmZdnchbnnZb28jpdnZ8pfgih5Z76beighZ5qmcpqhZ4q0jto5Z4000001Z3aokq95Z2qhxjljZ2br45qcZ1z141z5g��Q�	����g333333�r>g�r>r>r>r>)r
rr)r
rrr���g}Ô%�I��r?)
�assertEqual�int�L�
ValueError�repr�sys�maxsizeZassertIsInstance�assertRaises�	TypeError)�self�s�v�sign�prefix�ssZvv�xrrr�
test_basic s


'
zIntTestCases.test_basiccCs\|jtd�d�|jtd�d�|jtd�d�|jtd�d�dS)	Nrr	z-1rs10s-1r?r?)�assertIsrA)rIrrr�test_small_ints�szIntTestCases.test_small_intscCs|jt�d�dS)Nr)r@rA)rIrrr�test_no_args�szIntTestCases.test_no_argscCs�|jtdd�d�|jtddd�d�|jtdddd�d�|jttdd�|jttdd	�dS)
NrOg333333�?rr�baserr!r	r)r@rArGrH)rIrrr�test_keyword_args�s
zIntTestCases.test_keyword_argsc)Cs
|jtdd�d�|jt��tdd�WdQRX|jt��tdd�WdQRX|jt��tdd
�WdQRX|jt��tddd�WdQRX|jt��tddd
�WdQRXx3tdd�D]"}|jtdd|�d�q�WdS)Nrr"rr�%i�rTr��is���ll�l)r@rArGrC�range)rIrTrrr�test_int_base_limits�sz!IntTestCases.test_int_base_limitscCsL|jt��tdd�WdQRX|jt��tdd�WdQRXdS)Nrg@g@)rGrHrA)rIrrr�test_int_base_bad_types�sz$IntTestCases.test_int_base_bad_typescCs�Gdd�dt�}x2dD]*}|jt��td|�WdQRXqW|jtdd	|d��d
�|jtdd	|d��d�|jtdd	|d
��d�dS)Nc@s(eZdZdd�Zdd�ZdS)z9IntTestCases.test_int_base_indexable.<locals>.MyIndexablecSs
||_dS)N)�value)rIr[rrr�__init__szBIntTestCases.test_int_base_indexable.<locals>.MyIndexable.__init__cSs|jS)N)r[)rIrrr�	__index__szCIntTestCases.test_int_base_indexable.<locals>.MyIndexable.__index__N)rrrr\r]rrrr�MyIndexablesr^rrrrVZ43Z101rTr"r	�er<�l���)r`rarrVii)�objectrGrCrAr@)rIr^rTrrr�test_int_base_indexables
""z$IntTestCases.test_int_base_indexablec"s�Gdd�dt��Gdd�dt�}Gdd�dt�}tt�fdd�||tg}yd	d
lm�Wntk
r�YnX|j�fdd��x�|D]�}|d�}|jt|����|j	t
|�d
�t|tttf�r!|j	t
|d�d�n-d}|jt
|��t
|d�WdQRX|jtd��t
|d��WdQRXWdQRXq�WdS)Nc@seZdZdS)z<IntTestCases.test_non_numeric_input_types.<locals>.CustomStrN)rrrrrrr�	CustomStrsrdc@seZdZdS)z>IntTestCases.test_non_numeric_input_types.<locals>.CustomBytesN)rrrrrrr�CustomBytessrec@seZdZdS)zBIntTestCases.test_non_numeric_input_types.<locals>.CustomByteArrayN)rrrrrrr�CustomByteArraysrfcs�|j��S)N)�decode)�b)rdrr�<lambda>sz;IntTestCases.test_non_numeric_input_types.<locals>.<lambda>r)�arraycs
�d|�S)N�Br)rh)rjrrri'ss100rrr!zcan't convert non-stringzinvalid literal�ArsAAAAAAAAAAAAAAAA)�str�bytes�	bytearray�
memoryviewrj�ImportError�appendZsubTest�typer@rA�
isinstanceZassertRaisesRegexrHrC)rIrerfZ	factories�frO�msgr)rdrjr�test_non_numeric_input_typess2	

z)IntTestCases.test_non_numeric_input_typescCs�|jttd�dd��d�|jttd�dd��d�|jttd�dd��d�|jttd�dd��d�|jttd�dd��d�dS)	Ns123rrr/s123s123 s123As1234)r@rArp)rIrrr�test_int_memoryview6s
&&&&z IntTestCases.test_int_memoryviewcCs|jttd�dS)Nz1.2)rGrCrA)rIrrr�test_string_float=szIntTestCases.test_string_floatc s�Gdd�d�}|jtt|��Gdd�dt�}|jtt|��Gdd�d�}|jt|��d�Gdd	�d	�}xt|fD]�}Gd
d�d|�}|jt|��d�Gdd
�d
|�}|jt|��d�Gdd�d|�}|jt��t|��WdQRXxVt|fD]H}	Gdd�d|	��G�fdd�d|�}
|jt|
��d�G�fdd�d|	��G�fdd�d|�}yt|��Wn;tk
r#}z|jt|�d�WYdd}~XnX|jd||	ff�Gdd�d|	��G�fdd�d|�}
|jt��t|
��WdQRXqLWq�WdS)Nc@seZdZdS)z>IntTestCases.test_intconversion.<locals>.ClassicMissingMethodsN)rrrrrrr�ClassicMissingMethodsBsrzc@seZdZdS)z7IntTestCases.test_intconversion.<locals>.MissingMethodsN)rrrrrrr�MissingMethodsFsr{c@seZdZdd�ZdS)z-IntTestCases.test_intconversion.<locals>.Foo0cSsdS)N�*r)rIrrr�__int__Ksz5IntTestCases.test_intconversion.<locals>.Foo0.__int__N)rrrr}rrrr�Foo0Jsr~r|c@seZdZdS)z0IntTestCases.test_intconversion.<locals>.ClassicN)rrrrrrr�ClassicPsrc@s(eZdZdd�Zdd�ZdS)z:IntTestCases.test_intconversion.<locals>.IntOverridesTrunccSsdS)Nr|r)rIrrrr}TszBIntTestCases.test_intconversion.<locals>.IntOverridesTrunc.__int__cSsdS)Nri�r)rIrrr�	__trunc__VszDIntTestCases.test_intconversion.<locals>.IntOverridesTrunc.__trunc__N)rrrr}r�rrrr�IntOverridesTruncSsr�c@seZdZdd�ZdS)z2IntTestCases.test_intconversion.<locals>.JustTrunccSsdS)Nr|r)rIrrrr�[sz<IntTestCases.test_intconversion.<locals>.JustTrunc.__trunc__N)rrrr�rrrr�	JustTruncZsr�c@seZdZdd�ZdS)z9IntTestCases.test_intconversion.<locals>.ExceptionalTrunccSsdddS)Nrrr)rIrrrr�`szCIntTestCases.test_intconversion.<locals>.ExceptionalTrunc.__trunc__N)rrrr�rrrr�ExceptionalTrunc_sr�c@seZdZdd�ZdS)z1IntTestCases.test_intconversion.<locals>.IntegralcSsdS)Nr|r)rIrrrr}gsz9IntTestCases.test_intconversion.<locals>.Integral.__int__N)rrrr}rrrr�Integralfsr�cs"eZdZ�fdd�ZdS)z;IntTestCases.test_intconversion.<locals>.TruncReturnsNonIntcs��S)Nr)rI)r�rrr�kszEIntTestCases.test_intconversion.<locals>.TruncReturnsNonInt.__trunc__N)rrrr�r)r�rr�TruncReturnsNonIntjsr�cs"eZdZ�fdd�ZdS)z4IntTestCases.test_intconversion.<locals>.NonIntegralcs��S)Nr)rI)�NonIntegralrrr�psz>IntTestCases.test_intconversion.<locals>.NonIntegral.__trunc__N)rrrr�r)r�rrr�osr�cs"eZdZ�fdd�ZdS)z@IntTestCases.test_intconversion.<locals>.TruncReturnsNonIntegralcs��S)Nr)rI)r�rrr�uszJIntTestCases.test_intconversion.<locals>.TruncReturnsNonIntegral.__trunc__N)rrrr�r)r�rr�TruncReturnsNonIntegraltsr�z2__trunc__ returned non-Integral (type NonIntegral)z!Failed to raise TypeError with %sc@seZdZdd�ZdS)z/IntTestCases.test_intconversion.<locals>.BadIntcSsdS)NgE@r)rIrrrr}�sz7IntTestCases.test_intconversion.<locals>.BadInt.__int__N)rrrr}rrrr�BadInt�sr�cs"eZdZ�fdd�ZdS)z;IntTestCases.test_intconversion.<locals>.TruncReturnsBadIntcs��S)Nr)rI)r�rrr��szEIntTestCases.test_intconversion.<locals>.TruncReturnsBadInt.__trunc__N)rrrr�r)r�rr�TruncReturnsBadInt�sr�)rGrHrArbr@�ZeroDivisionErrorrmZfail)rIrzr{r~rrTr�r�r�Ztrunc_result_baser�r��er�r)r�r�r�r�test_intconversion@s@	zIntTestCases.test_intconversioncCsxGdd�dt�}Gdd�dt�}|d�}|j|d�|jt|�d�|jtt|��dS)Nc@seZdZdd�ZdS)z6IntTestCases.test_int_subclass_with_int.<locals>.MyIntcSsdS)Nr|r)rIrrrr}�sz>IntTestCases.test_int_subclass_with_int.<locals>.MyInt.__int__N)rrrr}rrrr�MyInt�sr�c@seZdZdd�ZdS)z7IntTestCases.test_int_subclass_with_int.<locals>.BadIntcSsdS)NgE@r)rIrrrr}�sz?IntTestCases.test_int_subclass_with_int.<locals>.BadInt.__int__N)rrrr}rrrrr��sr�r$r|)rAr@rGrH)rIr�r�Zmy_intrrr�test_int_subclass_with_int�sz'IntTestCases.test_int_subclass_with_intcszGdd�d��Gdd�dt�}G�fdd�d�}Gdd�d�}��}|jt��t|�}WdQRX|j|d	�|�}|jt��t|�}WdQRX|j|d	�|�}|jt��t|�}WdQRX|j|d	�|�}t|�}|j|d	�|jt|�t�t|�}|j|d	�|jt|�t�dS)
Nc@seZdZdd�ZdS)z:IntTestCases.test_int_returns_int_subclass.<locals>.BadIntcSsdS)NTr)rIrrrr}�szBIntTestCases.test_int_returns_int_subclass.<locals>.BadInt.__int__N)rrrr}rrrrr��sr�c@seZdZdd�ZdS)z;IntTestCases.test_int_returns_int_subclass.<locals>.BadInt2cSsdS)NTr)rIrrrr}�szCIntTestCases.test_int_returns_int_subclass.<locals>.BadInt2.__int__N)rrrr}rrrr�BadInt2�sr�cs"eZdZ�fdd�ZdS)zFIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadIntcs��S)Nr)rI)r�rrr��szPIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsBadInt.__trunc__N)rrrr�r)r�rrr��sr�c@seZdZdd�ZdS)zKIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsIntSubclasscSsdS)NTr)rIrrrr��szUIntTestCases.test_int_returns_int_subclass.<locals>.TruncReturnsIntSubclass.__trunc__N)rrrr�rrrr�TruncReturnsIntSubclass�sr�r)rAZassertWarns�DeprecationWarningr@rQrs�boolr)rIr�r�r�Zbad_int�nZgood_intr)r�r�test_int_returns_int_subclass�s.				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s��jtdd||f��-}|dkr;t|�n
t||�WdQRX�j|jjdd|dkrwdn||f�dS)Nrvzint(%r, %r)rz*invalid literal for int() with base %d: %rr	)rGrCrAr@�	exception�args)rJrT�cm)rIrr�check�s
z.IntTestCases.test_error_message.<locals>.check�½u123½z  123 456  z123r	z123 245r,rz123245s123s123�u123�r)rIr�r)rIr�test_error_message�s 













zIntTestCases.test_error_messageN)rrrrPrZcpython_onlyrRrSrUrYrZrcrwrxryr�r�r�r�rrrrrs�#M(r�__main__)rEZunittestZtestrrDrFrCrBrArZTestCaserr�mainrrrr�<module>s2																��