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_float.cpython-39.opt-2.pyc

a

��g��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZddl
mZmZmZmZed�Zed�Zeed�Ze�ed�Ze�eed	�d
�Zej�e�p�ejZej�ed�Z Gdd
�d
e�Z!Gdd�de�Z"Gdd�dej#�Z$eGdd�dej#��Z%dZ&e'e(e&��Z)dZ*e'e(e*��Z+dZ,e'e(e,��Z-dZ.e'e(e.��Z/eGdd�dej#��Z0Gdd�dej#�Z1Gdd�dej#�Z2Gdd�dej#�Z3e	j4Gd d!�d!ej#��Z5Gd"d#�d#ej#�Z6ej7Z8ej9Z:Gd$d%�d%ej#�Z;e<d&k�r�e�=�dS)'�N)�support)�VALID_UNDERSCORE_LITERALS�INVALID_UNDERSCORE_LITERALS)�isinf�isnan�copysign�ldexp�inf�nan�
__getformat__zrequires __getformat__�
__setformat__zrequires __setformat__zformatfloat_testcases.txtc@seZdZdS)�
FloatSubclassN��__name__�
__module__�__qualname__�rr�+/usr/local/lib/python3.9/test/test_float.pyr
sr
c@seZdZdS)�OtherFloatSubclassNrrrrrrsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Ze�	ddd
�dd��Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zejd d!��Zejd"d#��Zd$S)%�GeneralFloatCasescCsT|�td�d�|�td�d�|�td�d�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd	�|�ttd
�|�ttd�|�ttd�|�ttd
�|�ttd�|�ttd�|�tti�|�tdti�|�ttd�|�ttd�|�ttd�|�td�d�|�td�d�td�td�|�ttd�dS)N���Q�	@i:g�s@�  3.14  �	  0x3.1  �  -0x3.p-1  �  +0x3.p-1  z++3.14z+-3.14z-+3.14z--3.14z.nanz+.inf�.z-.z
not 'dict'u�z-1.7d29z3D-14u  ٣.١٤  u
 3.14 s�.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111a�.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111uこんにちは)�assertEqual�float�assertRaises�
ValueError�	TypeError�assertRaisesRegex��selfrrr�
test_float$s0zGeneralFloatCases.test_floatc	s�tD]J�t�fdd�dD��s|�t��t���|�t��t��dd���qtD]2��dvrbqTt�fdd�dD��sT|�tt��qT|�ttd�|�ttd	�|�ttd
�|�ttd�|�ttd�|�ttd
�dS)Nc3s|]}|�vVqdS�Nr��.0Zch�Zlitrr�	<genexpr>E�z5GeneralFloatCases.test_underscores.<locals>.<genexpr>ZjJxXoObB�_�)Z0_7Z09_99c3s|]}|�vVqdSr%rr&r(rrr)Kr*Z_NaNZNa_NZIN_Fz-_INFz-INF_s0_.�9)	r�anyrr�eval�replacerrrr"rr(r�test_underscoresCsz"GeneralFloatCases.test_underscoresc
s
Gdd�dt��Gdd�dt�}Gdd�dt�}tt�fdd�||tg}zd	d
lm�WntyjYn0|��fdd��|D]�}|d�}|�t|���X|�	t
|�d
�|�td��t
|d��Wd�n1s�0YWd�q�1s�0Yq�dS)Nc@seZdZdS)zAGeneralFloatCases.test_non_numeric_input_types.<locals>.CustomStrNrrrrr�	CustomStr[r*r1c@seZdZdS)zCGeneralFloatCases.test_non_numeric_input_types.<locals>.CustomBytesNrrrrr�CustomBytes\r*r2c@seZdZdS)zGGeneralFloatCases.test_non_numeric_input_types.<locals>.CustomByteArrayNrrrrr�CustomByteArray]r*r3cs�|���Sr%)�decode��b)r1rr�<lambda>br*z@GeneralFloatCases.test_non_numeric_input_types.<locals>.<lambda>r��arraycs
�d|�S)N�Brr5r8rrr7lr*s 3.14  rzcould not convertsAAAAAAAAAAAAAAAA)
�str�bytes�	bytearray�
memoryviewr9�ImportError�appendZsubTest�typerrr!r)r#r2r3Z	factories�f�xr)r1r9r�test_non_numeric_input_typesXs*
�z.GeneralFloatCases.test_non_numeric_input_typescCs�|�ttd�dd��d�|�ttd�dd��d�|�ttd�dd��d�|�ttd�dd��d�|�ttd�dd��d�dS)	Ns12.3��gffffff@s12.3s12.3 s12.3As12.34)rrr>r"rrr�test_float_memoryviewus
z'GeneralFloatCases.test_float_memoryviewcs`�fdd�}|d�|d�|d�|d�|d�|d�|d	�|d
�|d�|d�dS)
NcsX�jtd|fd��}t|�Wd�n1s20Y��t|j�d|f�dS)Nz	float(%r))�msgz%could not convert string to float: %r)rrrrr;�	exception)�s�cmr"rr�check}s
&�z3GeneralFloatCases.test_error_message.<locals>.check�½u123½z  123 456  s  123 456  u٣١٤!z123z123 245z123245s123s123�r)r#rLrr"r�test_error_message|sz$GeneralFloatCases.test_error_message�
LC_NUMERIC�fr_FR�de_DEcCs*ddl}|��ddks"|�d�|�td�d�|�td�d�|�td�d	�|�td
�d�|�td�d
�|�td�d�|�td�d�|�td�d�|�td�d�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd�|�td�d�|�td�d�dS) Nr�
decimal_point�,zdecimal_point is not ","rrz+3.14  z-3.14  g��Q�	�z.14  g�Q���?z3.  �@z3.e3  gp�@z3.2e3  g�@z2.5e-1  ��?z5e-1��?z  3,14  z	  +3,14  z	  -3,14  rrrz
  25.e-1  �@z
  .25e-1  g�������?)�locale�
localeconvZskipTestrrrrZassertAlmostEqual)r#rXrrr�test_float_with_comma�s(
z'GeneralFloatCases.test_float_with_commac
Cs`Gdd�dt�}Gdd�dt�}Gdd�dt�}Gdd�dt�}Gd	d
�d
t�}|�t|��d�|�t|��d�|�t��$|�t|d��d�Wd�n1s�0Y|�tt|d
��|�t|d��d�Gdd�d�}|�ttj	|��Gdd�d�}|�t��"|�t|��d�Wd�n1�s:0Y|�t��&|�
tt|���t�Wd�n1�s|0Y|�t��"|�t|��d�Wd�n1�s�0Y|�t��&|�
tt|���t�Wd�n1�s�0YGdd�d�}|�t|d
��d�|�t
t|dd��Gdd�d�}	|�tt|	��dS)Nc@seZdZdd�ZdS)z4GeneralFloatCases.test_floatconversion.<locals>.Foo1cSsdS�N�E@rr"rrr�	__float__�sz>GeneralFloatCases.test_floatconversion.<locals>.Foo1.__float__N�rrrr]rrrr�Foo1�sr_c@seZdZdd�ZdS)z4GeneralFloatCases.test_floatconversion.<locals>.Foo2cSsdSr[rr"rrrr]�sz>GeneralFloatCases.test_floatconversion.<locals>.Foo2.__float__Nr^rrrr�Foo2�sr`c@seZdZddd�Zdd�ZdS)z4GeneralFloatCases.test_floatconversion.<locals>.Foo3�cSst�|d|�S)N��r�__new__��cls�valuerrrrd�sz<GeneralFloatCases.test_floatconversion.<locals>.Foo3.__new__cSs|Sr%rr"rrrr]�sz>GeneralFloatCases.test_floatconversion.<locals>.Foo3.__float__N)ra)rrrrdr]rrrr�Foo3�s
rhc@seZdZdd�ZdS)z4GeneralFloatCases.test_floatconversion.<locals>.Foo4cSsdS�N�*rr"rrrr]�sz>GeneralFloatCases.test_floatconversion.<locals>.Foo4.__float__Nr^rrrr�Foo4�srkc@seZdZdd�ZdS)z6GeneralFloatCases.test_floatconversion.<locals>.FooStrcSstt|��dS�NrE)rr;r"rrrr]�sz@GeneralFloatCases.test_floatconversion.<locals>.FooStr.__float__Nr^rrrr�FooStr�srmr\�rj�8g"@c@seZdZdd�ZdS)z4GeneralFloatCases.test_floatconversion.<locals>.Foo5cSsdS)Nr,rr"rrrr]�sz>GeneralFloatCases.test_floatconversion.<locals>.Foo5.__float__Nr^rrrr�Foo5�srpc@seZdZdd�ZdS)z1GeneralFloatCases.test_floatconversion.<locals>.FcSstd�Sr[)rr"rrrr]�sz;GeneralFloatCases.test_floatconversion.<locals>.F.__float__Nr^rrrr�F�srqc@seZdZdd�Zdd�ZdS)z7GeneralFloatCases.test_floatconversion.<locals>.MyIndexcSs
||_dSr%�rg�r#rgrrr�__init__�sz@GeneralFloatCases.test_floatconversion.<locals>.MyIndex.__init__cSs|jSr%rrr"rrr�	__index__�szAGeneralFloatCases.test_floatconversion.<locals>.MyIndex.__index__N)rrrrtrurrrr�MyIndex�srvrbi�c@seZdZdd�ZdS)z5GeneralFloatCases.test_floatconversion.<locals>.MyIntcSsdSrirr"rrr�__int__�sz=GeneralFloatCases.test_floatconversion.<locals>.MyInt.__int__N)rrrrwrrrr�MyInt�srx)�objectrr;rZassertWarns�DeprecationWarningrr �time�sleep�assertIsrAr
�
OverflowError)
r#r_r`rhrkrmrprqrvrxrrr�test_floatconversion�s622626z&GeneralFloatCases.test_floatconversioncCs:|�td��tdd�Wd�n1s,0YdS)Nzkeyword argumentz3.14�rC)r!r rr"rrr�test_keyword_args�sz#GeneralFloatCases.test_keyword_argscCsD|�d���|�d���|�td����|�td����dS)Ng�������?��?r
r	)ZassertFalse�
is_integer�
assertTruerr"rrr�test_is_integer�sz!GeneralFloatCases.test_is_integercCs^dD]\}}|�|��|�qtd�D]B}t��}|dt�dd�9}|��\}}|�t|��|�|�q&tj}|�|dd�|td�����|�|d	d
�|td�����|�|dd
�|td�����|�|d
d�|td�����|�|dd�|td�����|�|dd�|td�����|�	t
td�j�|�	t
td�j�|�	ttd�j�dS)N))g�?)��)g�)i����r�)ra)rrE)g'@)�rb�'�
i�����drrEra�rbrWrVl�L�33�l@g������@l�����L�33�g�������i���gh��r	�-infr
)r�as_integer_ratio�range�random�randintr�__truediv__�	fractionsZFractionrr~r)r#rBZratio�i�n�d�Rrrr�test_floatasratio�s:������z#GeneralFloatCases.test_floatasratiocCsjttddtf}|D]d}|�||g�|�||f�|�||h�|�||di�|�|g�|�dd|�|�||�q|D]�}|�|g|gkd||f�|�|f|fkd||f�|�|h|hkd||f�|�|di|dikd||f�|g|f|h|dif\}}}}|�||kd	|�|�||kd
|�|�||kd|�|�||kd|�q~dS)
Nrar�rEz[].count('%r') != 1z[%r] != [%r]z(%r,) != (%r,)z{%r} != {%r}z{%r : None} != {%r : None}z[%r] not equal to itselfz(%r,) not equal to itselfz{%r} not equal to itselfz{%r : None} not equal to itself)�INF�NAN�assertInr�countr�)r#ZfloatsrB�l�trJr�rrr�test_float_containments(�z(GeneralFloatCases.test_float_containmentcCs$|�|td|�f|td|�f�dS)Nr�)rr)r#�ar6rrr�assertEqualAndEqualSign5sz)GeneralFloatCases.assertEqualAndEqualSigncCs�|�td���t�|�td���d�|�td���d�|�td���d�|�td���d�|�td���d�|�td	���d
�|�td���d�|�td���d�|�ttd
�j�|�ttd�j�|�ttd�j�dS)NrVrr�rE��?���������������Nݯ�b��Nݯ��r
r	r�)�assertIsInstancer�	__floor__�intrrrr~r"rrr�test_float_floor;sz"GeneralFloatCases.test_float_floorcCs�|�td���t�|�td���d�|�td���d�|�td���d�|�td���d�|�td���d	�|�td
���d	�|�td���d�|�td���d�|�ttd
�j�|�ttd�j�|�ttd�j�dS)NrVrEr�r�rbr�rr�r�r�r�r�r
r	r�)r�r�__ceil__r�rrrr~r"rrr�test_float_ceilIsz!GeneralFloatCases.test_float_ceilcCs�tj}|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�dS)Nr�r�ra�0��.�+����0��.�++)�operator�modr�)r#r�rrr�test_float_modWsz GeneralFloatCases.test_float_modcCs�	ttjfD�	]�}|�t|tt���|�t|dt���|�t|dt���|�t|dt���|�t|dt���|�t|dt���|�t|dt���|�t|dt���|�t|tt���|�t|tt���|�t|tt���|�t|td���|�t|td���|�t|td���|�t|td���|�t|td���|�t|td���|�t|tt���|�t|dd�|�t|dd�|�t|dd�|�t|dd�|�t|dd�|�t|dd�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dt�d�|�|dt�d�|�|dt�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dt�d�|�|dt�d�|�|td�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|td�d�|�|td�d�|�|td�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|td�d�|�|td�d�|�	t
|dd��t�|�	t
|dd��t�|�	t
|dd��t�|�	t
|dd��t�|�	t
|dd��t�|�	t
|dd��t�|�|dt�t�|�|dt�t�|�|dt�t�|�|dt�t�|�|tt�d�|�|dt�d�|�|dt�d�|�|tt�d�|�|dt�d�|�|dt�d�|�|dt�d�|�|dt�d�|�|tt�t�|�|dt�t�|�|dt�t�|�|tt�t�|�|td�d�|�|td�d�|�|td�d�|�|td�t�|�|td�t�|�|td�t�|�|td�t�|�|td�t�|�|td�t�|�|td�d�|�|td�d�|�|td�d�|�|dd�d	�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d
�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d	�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d
�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd
�d�|�	t
|dd��t�|�|dd�d�|�|dd
�d�|�|dd�d�|�|dd�d�|�|dd�d�|�	t
|dd��t�|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d�q
dS)Ng�r�r�r�rarV�@r�rUg@�}Ô%�I���}Ô%�I�Tg@��gB��gD��g@�@gB�@gD�@)�powr�r�rr�r�r�ZeroDivisionErrorr�rrA�complex)r#Zpow_oprrr�test_float_powksz GeneralFloatCases.test_float_powN)rrrr$r0rDrGrNrZrun_with_localerZrr�r�r�r�r�r�r��requires_IEEE_754r�r�rrrrr"s&
C!
rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�FormatFunctionsTestCasecCst�d�t�d�d�|_dS)N�doubler�r�r)rr�save_formatsr"rrr�setUp8s�zFormatFunctionsTestCase.setUpcCs(t�d|jd�t�d|jd�dS�Nr�r�rrr�r"rrr�tearDown<sz FormatFunctionsTestCase.tearDowncCsP|�t�d�gd��|�t�d�gd��|�ttjd�|�ttjd�dS)Nr�)�unknown�IEEE, big-endian�IEEE, little-endianr�chickenrE)r�rrrrr r"rrr�test_getformat@s��z&FormatFunctionsTestCase.test_getformatcCs�dD]�}t�|d�|j|dkr6|�ttj|d�nF|j|dkrX|�ttj|d�n$|�ttj|d�|�ttj|d�|�ttj|d�q|�ttjdd�dS)Nr�r�r�r�r�)rrr�rr)r#r�rrr�test_setformatHs,
�
�
�
�
�
�z&FormatFunctionsTestCase.test_setformatN)rrrr�r�r�r�rrrrr�5sr�s�s�s�s�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�UnknownFormatTestCasecCs4t�d�t�d�d�|_t�dd�t�dd�dS)Nr�rr�r�)rrr�rr"rrrr�js
�zUnknownFormatTestCase.setUpcCs(t�d|jd�t�d|jd�dSr�r�r"rrrr�pszUnknownFormatTestCase.tearDowncCs<dtfdtfdtfdtffD]\}}|�ttj||�qdS�Nz>dz<d)�
BE_DOUBLE_INF�
BE_DOUBLE_NAN�
LE_DOUBLE_INF�
LE_DOUBLE_NANrr�struct�unpack�r#�fmt�datarrr� test_double_specials_dont_unpackts�z6UnknownFormatTestCase.test_double_specials_dont_unpackcCs<dtfdtfdtfdtffD]\}}|�ttj||�qdS�Nz>f�<f)�BE_FLOAT_INF�BE_FLOAT_NAN�LE_FLOAT_INF�LE_FLOAT_NANrrr�r�r�rrr�test_float_specials_dont_unpack{s�z5UnknownFormatTestCase.test_float_specials_dont_unpackN)rrrr�r�r�r�rrrrr�hsr�c@s6eZdZejdd��Zejdd��Zejdd��ZdS)�IEEEFormatTestCasecCs6dtfdtfdtfdtffD]\}}t�||�qdSr�)r�r�r�r�r�r�r�rrr�test_double_specials_do_unpack�s�z1IEEEFormatTestCase.test_double_specials_do_unpackcCs6dtfdtfdtfdtffD]\}}t�||�qdSr�)r�r�r�r�r�r�r�rrr�test_float_specials_do_unpack�s�z0IEEEFormatTestCase.test_float_specials_do_unpackcCsJddlm}|�t�dd�t�d|��|�t�dd�t�d|��dS)Nr)�FLT_MAXr�gn���Ggn����)Z	_testcapir�rr��pack)r#r�rrr�test_serialized_float_rounding�sz1IEEEFormatTestCase.test_serialized_float_roundingN)rrrrr�r�r�r�rrrrr��s

r�c@s2eZdZdd�Zejdd��Zdd�Zdd�Zd	S)
�FormatTestCasecCs@|�tdd�d�|�tdd�d�|�tdd�d�|�tdd�d�d	}|�t|d�t|��|�t|d
�t|��|�t|d�t|��|�t|d�t|��|�td
d�d�|�tdd�d�|�td
d�d�|�tdd�d�|�td
d�d�|�tdd�d�|�tdd�d�|�ttdd�dd�ttd�td�d�D�dd�ttd�td �d�D�D]�}|d!v�rr|�ttd|�|�ttd
|�|�ttd|�|�ttd"|�|�ttd#|�|�ttd$|�|�ttd%|��qr|�ttd�d&�|�ttd'�d(�|�ttd�d)�|�ttd'�d*�dS)+NrarBz0.000000r,�0.0g{�G�z�?�0.01�gg%I�$I�,@�-�>�2r�z1.000000r�z	-1.000000z fz	 1.000000z+fz	+1.000000�%z-100.000000%rTrJcSsg|]}t|��qSr��chr�r'rCrrr�
<listcomp>�r*z.FormatTestCase.test_format.<locals>.<listcomp>r��zrEcSsg|]}t|��qSrr�r�rrrr��r*�A�ZzeEfFgGn%r�r�r�r�r
rqr�r	r�)	r�formatr;rrr��ordr�r�)r#rC�format_specrrr�test_format�s@�
zFormatTestCase.test_formatcCs�tt���}|D]n}|�d�rq|��}|s,qttj|�d��\}}|��\}}|�|t|�|�|�|t|�d|�qWd�n1s�0YdS)Nz--z->r�)	�open�format_testfile�
startswith�strip�mapr;�splitrr)r#Ztestfile�lineZlhsZrhsr��argrrr�test_format_testfile�s

z#FormatTestCase.test_format_testfilecCs:|�tdd�d�|�tdd�d�|�tdd�d�dS)N�w��/�^@z.4z123.5g
ףp=J�@z	1.235e+03g������@z	1.235e+04�rr�r"rrr�test_issue5864�szFormatTestCase.test_issue5864cCs$|�tdd�d�|�tdd�d�|�tdd�d�|�tdd	�d
�|�tdd�d�|�tdd
�d�|�tdd�d
�|�tdd�d�|�tdd�d�|�tdd�d�|�tdd�d�|�tdd	�d�|�tdd�d�|�tdd�d�|�tdd
�d�|�tdd�d�dS)Ng�^@Z00z123.0g�(\���^@Z00fz
123.340000Z00ez1.233400e+02Z00gz123.34z00.10fz123.3400000000z00.10ez1.2334000000e+02z00.10gZ01fg�^�z-123.0g�(\���^�z-123.340000z
-1.233400e+02z-123.34z-123.3400000000z-1.2334000000e+02rr"rrr�test_issue35560�s zFormatTestCase.test_issue35560N)	rrrr�rr�rrrrrrrr��s
5
r�c@s4eZdZdd�Ze�eedd�dkd�dd��Zd	S)
�ReprTestCasecCs�ttj�tj�t�dd���N}|D]8}|��}|r$|�d�r@q$t|�}|�	|tt
|���q$Wd�n1sr0YdS)Nrzfloating_points.txt�#)r��os�path�joinr��__file__r�r�r.r�repr)r#Zfloats_filer��vrrr�	test_repr�s�zReprTestCase.test_repr�float_repr_styler,�short�.applies only when using short float repr stylecCs~gd�}|D]l}d|}|�|tt|���|�|tt|���|�tt|��tt|���|�tt|��tt|���qdS)N)r��1.0r�z0.02z0.03z0.04z0.05z
1.23456789z10.0z100.0z1000000000000000.0z9999999999999990.0z1e+16z1e+17z0.001z0.001001z0.00010000000000001z0.0001z9.999999999999e-05z1e-05z8.72293771110361e+25z7.47005307342313e+26z2.86438000439698e+28z8.89142905246179e+28z3.08578087079232e+35r�)rrrr;)r#Ztest_stringsrJZnegsrrr�test_short_repr	s
"zReprTestCase.test_short_reprN)	rrrr
�unittest�
skipUnless�getattr�sysrrrrrr�s

�rc@s|eZdZdd�Zdd�Zdd�Zdd�Ze�e	e
d	d
�dkd�d
d��Ze�e	e
d	d
�dkd�dd��Zdd�Z
dd�ZdS)�
RoundTestCasecCsr|�ttt�|�ttt�|�ttt�|�tttd�|�tttd�|�tttd�|�ttdd�dS)Nrar�zceci n'est pas un integerr�y�?)rr~�roundr�rr�r r"rrr�test_inf_nan@szRoundTestCase.test_inf_nancCs�ddddddddfD]L}|�td	|�d	�|�td
|�d
�|�td|�d�|�td|�d�q|�td
d�d
�|�tdd�d�|�tdd�d�|�td
d�d
�|�tdd�d�dS)NiDiEi�i���llrbr�r�w��/�^��u�<�7~��g��P.5�_i,i3go���!	�i4i5gS��i;g�i�rr�r#r�rrr�test_large_nIszRoundTestCase.test_large_ncCsjddddddddfD]L}|�td	|�d
�|�td|�d�|�td
|�d
�|�td|�d
�qdS)N����i���ip���i�i�l����rbr�rrarr�rrrrrrr�test_small_nUs
zRoundTestCase.test_small_ncCs$|�ttdd�|�ttdd�dS)Ng3t�<{�r gv;w0�B�)rr~rr"rrr�
test_overflow\szRoundTestCase.test_overflowrr,rrcCs�|�tdd�d�|�tdd�d�|�tdd�d�|�tdd�d	�|�td
d�d	�|�tdd�d�|�td
d�d�|�tdd�d�|�tdd�d�|�tdd�d�dS)NgCrEg�������B�g9@r�g4@g�A@gD@g�F@g�K@gN@g@P@g�R@gT@g@U@g�W@gY@rr"rrr�test_previous_round_bugs`s��z&RoundTestCase.test_previous_round_bugscCs�td�D]|}|d}|�tt|d��t|d��|�tt|d��t|d��|�tt|d��t|d��|�tt|d	��t|d
��qtddd
�D]|}|d}|�tt|d��t|d��|�tt|d��t|d��|�tt|d��t|d��|�tt|d	��t|d
��q�td�D]~}t��}|�tt|d��t|d��|�tt|d��t|d��|�tt|d��t|d��|�tt|d	��t|d
���qdS)Ni�g@�@z.0frz.1frEz.2frbz.3fr#r�i�r�)r�rrr�rr�)r#r�rCrrr�test_matches_float_formatrs$z'RoundTestCase.test_matches_float_formatcs��fdd�}dD]�}d|dd�}d|dd�}||td�||td�||td	�||td	�||td
�||td�||td�||td�||td�||td�||td
�||td
�qdS)Ncs6��||||�|dd�}��t||�||�dSrlr)r�rg�expectedr"rr�test�sz0RoundTestCase.test_format_specials.<locals>.test)z%ez%fz%gz%.0ez%.6fz%.20gz%#ez%#fz%#gz%#.20ez%#.15fz%#.3gz%+rEz% r	r�r
�+inf�+nanz infz nan)r�r�)r#r'r�ZpfmtZsfmtrr"r�test_format_specials�s z"RoundTestCase.test_format_specialscCsxtd�tdd�tddd�fD]}|�|d�|�|t�qtd�tdd�tddd�fD]}|�|d�|�|t�qVdS)Ng�G�z��?)�ndigitsrEg{�G�z�?rb)rrr�r�)r#rCrrr�test_None_ndigits�s  zRoundTestCase.test_None_ndigitsN)rrrrrr!r"rrrrr$r%r*r,rrrrr=s	�
�
rc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Ze�	e
edd�d
kd�dd��ZdS)�
InfNanTestcCs�|�ttd���|�ttd���|�ttd���|�ttd���|�ttd���|�ttd���|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd	��d�|�ttd
��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd
�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd�|�ttd�dS)Nr	r(r�Zinfinityz	+infinity�	-infinityr��+Infz-iNF�Infinityz	+iNfInItYz	-INFINITY�infoz+infoz-info�inz+inz-inZinfinitz+Infinz-INFIZ	infinitysz++Infz-+infz
+-infinityz
--Infinity)r�rrrrr;rrr"rrr�test_inf_from_str�sLzInfNanTest.test_inf_from_strcCsD|�td�d�|�td�d�|�td�d�|�td�d�dS)Ng�r	g�r��rrr;r"rrr�test_inf_as_str�szInfNanTest.test_inf_as_strcCsz|�ttd���|�ttd���|�ttd���|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd��d�|�ttd�|�ttd�|�ttd	�|�ttd
�|�ttd�|�ttd�|�ttd
�|�ttd�|�ttd�|�ttd�dS)Nr
r)�-nanr�z+NAn�-NaNZnanaz+nanaz-nanaZnaz+naz-naz++nanz-+NAN�+-NaNz--nAn)r�rrrrr;rrr"rrr�test_nan_from_str�s,zInfNanTest.test_nan_from_strcCsD|�td�d�|�td�d�|�td�d�|�td�d�dS)Ng��r
g��g��g��r4r"rrr�test_nan_as_strszInfNanTest.test_nan_as_strcCs0|�tdtd��d�|�tdtd��d�dS)Nr�r	r�r��rrrr"rrr�test_inf_signs
szInfNanTest.test_inf_signsrr,rrcCs0|�tdtd��d�|�tdtd��d�dS)Nr�r
r6r�r;r"rrr�test_nan_signsszInfNanTest.test_nan_signsN)
rrrr3r5r9r:r<rrrrr=rrrrr-�s-�r-c@sdeZdZed�Zed�Zed�Zed�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�ZdS)�HexFloatTestCasez0x.fffffffffffff8p+1024z	0x1p-1022z0x0.0000000000001p-1022z0x0.0000000000001p0cCsdt|�st|�r&t|�t|�krNdSn(||krN|dksJtd|�td|�krNdS|�d||f�dS)Nrar�z%r not identical to %r)rr�fail)r#rC�yrrr�	identical"s$zHexFloatTestCase.identicalcCsb|�|jtdd��|�|jtdd��|�|jtdd��|�|jdtdd�tdd��dS)Nr�i���i���i���r�i�i�)rA�MINr�TINY�EPS�MAXr"rrr�	test_ends,szHexFloatTestCase.test_endsc	CsHgd�}|D]6}zt|�}Wnty.Yq0|�d||f�qdS)N)3Zinfiz-Infinitz++infz-+Infz--nanr8ZsnanZNaNsZnnaZanZnfZnfinityZinityZiinityZ0xnanr,� zx1.0p0z0xX1.0p0z	+ 0x1.0p0z	- 0x1.0p0z0 x1.0p0z0x 1.0p0z	0x1 2.0p0z	+0x1 .0p0z0x1. 0p0z
-0x1.0 1p0z	-0x1.0 p0z
+0x1.0p +0z	0x1.0p -0z0x1.0p 0z
+0x1.0p+ 0z
-0x1.0p- 0z
++0x1.0p-0z	--0x1.0p0z
+-0x1.0p+0z	-+0x1.0p0z	0x1.0p++0z
+0x1.0p+-0z
-0x1.0p-+0z	0x1.0p--0z0x1.0.p0z0x.p0z0x1,p0Z0x1pau0x1p0u0x1p0u0x1p0u	0x1.0p0z
0x1p0 
 0x2p0z0x1p0 0x1p0z>Expected float.fromhex(%r) to raise ValueError; got %r instead)�fromHexrr?)r#Zinvalid_inputsrC�resultrrr�test_invalid_inputs2s5�z$HexFloatTestCase.test_invalid_inputscCshdtfdtfdtfdddg}gd�}|D]8\}}|D]*}|D] }t|||�}|�||�q>q6q*dS)Nr	z	-Infinityr
)rr�)z-0x.2g��)z-0.0r�)r,rG�	�
z
 	���
)r�r�rHrA)r#Zvalue_pairs�
whitespace�inpr&Zlead�trailZgotrrr�test_whitespacers�
z HexFloatTestCase.test_whitespacecCs\|j}|j}|j}|j}|�td�t�|�td�t�|�td�t�|�td�t�|�td�t�|�td�t�|�td�t�|�td�t�|�td	�t�|�td
�t�|�td�t�|�td�t�|�td
�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td �d�|�td!�d�|�td"�d�|�td#�d�|�td$�d�|�td%�d�|�td&�d�|�td'�d�|�td(�d�|�td)�d�|�td*�d+�|�td,�d+�|�td-�d+�|�td.�d+�|�td/�d0�|�td1�d0�|�td2�d0�|�td3�d0�|�td4�d0�|�td5�d0�|�td6�d0�|�td7�d0�td8�}|�td9�|�|�td:�|�|�td;�|�|�td<�|�|�td=�|�|�td>�|�|�td?�|�|�td@�|�|�tdA�|�|�tdB�|�|�td8�|�|�tdC�|�|�tdD�|�|�tdE�|�|�tdF�|�|�tdG�|�|�tdH�|�|�tdI�|�|�tdJ�|�|�tdK�|�|�tdL�|�|�tdM�|�|�tdN�|�|�tdO�|�|�tdP�|�|�tdQ�|�|�tdR�|�|�tdS�|�|�tdT�|�|�tdU�|�|�tdV�|�|�tdW�|�|�t	tdX�|�t	tdY�|�t	tdZ�|�t	td[�|�t	td\�|�t	td]�|�t	td^�|�t	td_�|�t	td`�|�t	tda�|�t	tdb�|�t	tdc�|�t	tdd�|�t	tde�|�t	tdf�|�t	tdg�|�t	tdh�|�t	tdi�|�t	tdj�|�tdk�|�|�tdl�|�|�tdm�|�|�tdn�do�|�tdp�do�|�tdq�dr�|�tds�do�|�tdt�dr�|�tdu�do�|�tdv�do�|�tdw�dr�|�tdx�dr�|�tdy�do�|�tdz�dr�|�td{�dr�|�td|�dr�|�td}�do�|�td~�dr�|�td�do�|�td��do�|�td��dr�|�td��dr�|�td��do�|�td��dr�|�td��dr�|�td��|�|�td��|�|�td��|�|�td��do�|�td��do�|�td��|�|�td��|�|�td��|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��dr�|�td��dr�|�td��|�|�td��|�|�td��|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��d�|�|�td��|d�|�|�td��|d�|�|�td��|d�|�|�td��|d�|�|�td��|d�|�|�td��|d�|�|�td��|d�|�|�td��|d�|�|�td��|d�|�|�td��|d�|�|�td��||�|�td��||�|�td��||�|�td��||�|�td��||�|�td��||�|�td��||�|�td��|�|�td��|�|�tdƒ|�|�tdÃ|�|�tdă|�|�tdŃ|�|�tdƃ|�|�tdǃ|�|�tdȃ|�|�tdɃ||�|�tdʃ||�|�td˃||�|�td̃||�|�td̓||�|�td΃||�|�tdσ||�|�tdЃ|d�|�|�tdуd|�|�td҃d|�|�tdӃd|�|�tdԃd|�|�tdՃd|�|�tdփd|d��|�td׃d|d��|�td؃d|d��|�tdكd|d��|�tdڃd|d��|�tdۃd|d��|�td܃d|d��|�td݃d�|�tdރd�|�td߃d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�|�td�d|�|�td�d|�|�td�d|�|�td�d|�|�td�d|�|�td�d|�|�td�d|�|�td�d|�|�td��d|�|�td��d|�|�td��d|�|�td��d|�|�td��d|�|�td��d|�|�td��d|�|�td��d|�|�td��dd�|�|�td��dd�|�|�td��dd�|�|�t�d�dd�|�|�t�d�dd�|�|�t�d�dd�|�|�t�d�dd�|�|�t�d�dd�|�|�t�d�dd�|�|�t�d�dd�|�|�t�d�do�|�t�d�do�|�t�d	�|�|�t�d
�do�|�t�d�do�|�t�d�|�|�t�d
�do�|�t�d�|�|�t�d�do�|�t�d�do�|�t�d�dr�|�t�d�do�dS(Nr	r/z-INFZiNfr0z	+INFINITYr.z	-iNFiNitYr
z+NaNr7z-nAN�1r�z+1z1.rz1.0p0Z01z01.Z0x1z0x1.z0x1.0z+0x1.0Z0x1p0Z0X1p0Z0X1P0Z0x1P0z0x1.p0z0x1.0p0z0x.1p4z0x.1p04z0x.1p004z0x1p+0z0x1P-0z+0x1p0Z0x01p0Z0x1p00z 0x1p0 z
 0x1p0z0x1p0 	Z0xap0g$@Z0xAp0Z0xaP0Z0xAP0Z0xbep0g�g@Z0xBep0Z0xbEp0z0XBE0P-4Z0xBEp0z0xB.Ep4z0x.BEp8z	0x.0BEp12z0x1.921fb54442d18p1z0x.006487ed5110b46p11z0x.00c90fdaa22168cp10z0x.01921fb54442d18p9z0x.03243f6a8885a3p8z0x.06487ed5110b46p7z0x.0c90fdaa22168cp6z0x.1921fb54442d18p5z0x.3243f6a8885a3p4z0x.6487ed5110b46p3z0x.c90fdaa22168cp2z0x3.243f6a8885a3p0z0x6.487ed5110b46p-1z0xc.90fdaa22168cp-2z0x19.21fb54442d18p-3z0x32.43f6a8885a3p-4z0x64.87ed5110b46p-5z0xc9.0fdaa22168cp-6z0x192.1fb54442d18p-7z0x324.3f6a8885a3p-8z0x648.7ed5110b46p-9z0xc90.fdaa22168cp-10z0x1921.fb54442d18p-11z0x1921fb54442d1.8p-47z0x3243f6a8885a3p-48z0x6487ed5110b46p-49z0xc90fdaa22168cp-50z0x1921fb54442d18p-51z0x3243f6a8885a30p-52z0x6487ed5110b460p-53z0xc90fdaa22168c0p-54z0x1921fb54442d180p-55z	-0x1p1024z	0x1p+1025z	+0X1p1030z
-0x1p+1100Z0X1p123456789123456789z+0X.8p+1025z+0x0.8p1025z-0x0.4p1026z	0X2p+1023z	0x2.p1023z-0x2.0p+1023z
+0X4p+1022z0x1.ffffffffffffffp+1023z-0X1.fffffffffffff9p1023z0X1.fffffffffffff8p1023z+0x3.fffffffffffffp1022z0x3fffffffffffffp+970Z0x10000000000000000p960z-0Xffffffffffffffffp960z+0x1.fffffffffffffp+1023z-0X1.fffffffffffff7p1023z$0X1.fffffffffffff7fffffffffffffp1023Z0x0p0raZ0x0p1000z	-0x0p1023r�Z0X0p1024z	-0x0p1025Z0X0p2000Z0x0p123456789123456789z-0X0p-0z
-0X0p-1000z	0x0p-1023z
-0X0p-1024z
-0x0p-1025z
-0x0p-1072z	0X0p-1073z
-0x0p-1074z	0x0p-1075z	0X0p-1076z
-0X0p-2000z-0x0p-123456789123456789z	0X1p-1075z
-0X1p-1075z-0x1p-123456789123456789z0x1.00000000000000001p-1075z-0x1.1p-1075z0x1.fffffffffffffffffp-1075z	0x1p-1076z	0X2p-1076z	0X3p-1076z	0x4p-1076z	0X5p-1076z	0X6p-1076rbz	0x7p-1076z	0X8p-1076z	0X9p-1076z	0xap-1076z	0Xbp-1076r#z	0xcp-1076z	0Xdp-1076z	0Xep-1076rFz	0xfp-1076z
0x10p-1076z
-0x1p-1076z
-0X2p-1076z
-0x3p-1076z
-0X4p-1076z
-0x5p-1076z
-0x6p-1076r�z
-0X7p-1076z
-0X8p-1076z
-0X9p-1076z
-0Xap-1076z
-0xbp-1076���z
-0xcp-1076z
-0Xdp-1076z
-0xep-1076���z
-0Xfp-1076z-0X10p-1076z0x0.ffffffffffffd6p-1022z0x0.ffffffffffffd8p-1022z0x0.ffffffffffffdap-1022z0x0.ffffffffffffdcp-1022z0x0.ffffffffffffdep-1022z0x0.ffffffffffffe0p-1022z0x0.ffffffffffffe2p-1022z0x0.ffffffffffffe4p-1022z0x0.ffffffffffffe6p-1022z0x0.ffffffffffffe8p-1022z0x0.ffffffffffffeap-1022z0x0.ffffffffffffecp-1022z0x0.ffffffffffffeep-1022z0x0.fffffffffffff0p-1022z0x0.fffffffffffff2p-1022z0x0.fffffffffffff4p-1022z0x0.fffffffffffff6p-1022z0x0.fffffffffffff8p-1022z0x0.fffffffffffffap-1022z0x0.fffffffffffffcp-1022z0x0.fffffffffffffep-1022z0x1.00000000000000p-1022z0x1.00000000000002p-1022z0x1.00000000000004p-1022z0x1.00000000000006p-1022z0x1.00000000000008p-1022z0x1.0000000000000ap-1022z0x1.0000000000000cp-1022z0x1.0000000000000ep-1022z0x1.00000000000010p-1022z0x1.00000000000012p-1022z0x1.00000000000014p-1022z0x1.00000000000016p-1022z0x1.00000000000018p-1022z0x0.fffffffffffff0p0z0x0.fffffffffffff1p0z0X0.fffffffffffff2p0z0x0.fffffffffffff3p0z0X0.fffffffffffff4p0z0X0.fffffffffffff5p0z0X0.fffffffffffff6p0z0x0.fffffffffffff7p0z0x0.fffffffffffff8p0z0X0.fffffffffffff9p0z0X0.fffffffffffffap0z0x0.fffffffffffffbp0z0X0.fffffffffffffcp0z0x0.fffffffffffffdp0z0X0.fffffffffffffep0z0x0.ffffffffffffffp0z0X1.00000000000000p0z0X1.00000000000001p0z0x1.00000000000002p0z0X1.00000000000003p0z0x1.00000000000004p0z0X1.00000000000005p0z0X1.00000000000006p0z0X1.00000000000007p0z(0x1.00000000000007ffffffffffffffffffffp0z0x1.00000000000008p0z&0x1.00000000000008000000000000000001p0rEz0X1.00000000000009p0z0x1.0000000000000ap0z0x1.0000000000000bp0z0X1.0000000000000cp0z0x1.0000000000000dp0z0x1.0000000000000ep0z0X1.0000000000000fp0z0x1.00000000000010p0z0X1.00000000000011p0z0x1.00000000000012p0z0X1.00000000000013p0z0X1.00000000000014p0z0x1.00000000000015p0z0x1.00000000000016p0z0X1.00000000000017p0z(0x1.00000000000017ffffffffffffffffffffp0z0x1.00000000000018p0z&0X1.00000000000018000000000000000001p0z0x1.00000000000019p0z0X1.0000000000001ap0z0X1.0000000000001bp0z0x1.0000000000001cp0z0x1.0000000000001dp0z0x1.0000000000001ep0z0X1.0000000000001fp0z0x1.00000000000020p0z
0x.8p-1074z0x.80p-1074z0x.81p-1074z	0x8p-1078z0x8.0p-1078z0x8.1p-1078z
0x80p-1082z
0x81p-1082z.8p-1074z8p-1078z	-.8p-1074z+8p-1078)
rBrErCrDrArHr�r�rr~)r#rBrErCrD�pirrr�
test_from_hex�s&
�
�
�

�zHexFloatTestCase.test_from_hexc	Cs�dd�}tt|j|j|j|j|jdfD](}|�|||��|�|||��q(ddl}td�D]`}|�dd�}|��}|�	dd	g�}z|t
||�}Wnty�Yqb0|�|tt
|���qbdS)
NcSstt|��Sr%)rH�toHexr�rrr�	roundtrip�sz2HexFloatTestCase.test_roundtrip.<locals>.roundtriprarr�iP���i�r�r�)r�r�rErBrCrAr�r��	randrange�choicerr~rHrY)r#rZrCr�r��e�mrJrrr�test_roundtrip�s$zHexFloatTestCase.test_roundtripcCs�Gdd�dt�}|�d���}|�t|�|�|�|d�Gdd�dt�}|�d���}|�t|�|�|�|d�|�t|dd�d	�dS)
Nc@seZdZdd�ZdS)z)HexFloatTestCase.test_subclass.<locals>.FcSst�||d�Srlrcrerrrrd�sz1HexFloatTestCase.test_subclass.<locals>.F.__new__N)rrrrdrrrrrq�srqr�rWc@seZdZdd�ZdS)z*HexFloatTestCase.test_subclass.<locals>.F2cSs
d|_dS)N�bar)�foorsrrrrt�sz3HexFloatTestCase.test_subclass.<locals>.F2.__init__N)rrrrtrrrr�F2�srbraZnoner`)r�fromhex�hexr}rArr)r#rqrBrbrrr�
test_subclass�szHexFloatTestCase.test_subclassN)rrrrHrErBrCrDrArFrJrSrXr_rerrrrr>s
@-r>�__main__)>r�r�rr�rr�r{rr'rZtest.test_grammarrr�mathrrrrrr�r��hasattrZhave_getformatrZrequires_getformatZrequires_setformatr�dirnamer
�curdirZtest_dirr	r�r
rZTestCaserr�r�r<�reversedr�r�r�r�r�r�r�r�r�r�rr�rr-rcrHrdrYr>r�mainrrrr�<module>sl
��%^?vfF


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