Your IP : 216.73.216.60


Current Path : /opt/alt/python39/lib64/python3.9/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/__pycache__/test_bool.cpython-39.opt-2.pyc

a

XC?h�1�@sBddlZddlmZddlZGdd�dej�Zedkr>e��dS)�N)�supportc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9S):�BoolTestcCsHzGdd�dt�}Wnty&Yn0|�d�|�ttjtd�dS)Nc@seZdZdS)z!BoolTest.test_subclass.<locals>.CN)�__name__�
__module__�__qualname__�rr�3/opt/alt/python39/lib64/python3.9/test/test_bool.py�Csr	zbool should not be subclassabler)�bool�	TypeErrorZfail�assertRaises�int�__new__)�selfr	rrr�
test_subclass
s
zBoolTest.test_subclassc	Cs�z�ttjd��}tdd|d�Wd�n1s20Yttjd�� }|�|��d�Wd�n1sn0YWt�tj�nt�tj�0dS)N�wFT)�file�rzFalse True
)�openr�TESTFN�print�assertEqual�read�os�remove)rZfoZfirrr�
test_prints,0zBoolTest.test_printcCsL|�td�d�|�td�d�|�ttd��d�|�ttd��d�dS�NF�FalseT�True)r�repr�eval�rrrr�	test_reprszBoolTest.test_reprcCs$|�td�d�|�td�d�dSr)r�strr!rrr�test_str$szBoolTest.test_strcCsD|�td�d�|�td�d�|�td�d�|�td�d�dS)NFrT�)rr
�assertIsNotr!rrr�test_int(szBoolTest.test_intcCsD|�td�d�|�td�d�|�td�d�|�td�d�dS)NF�T��?)r�floatr&r!rrr�
test_float.szBoolTest.test_floatc	Cs*|�dd�|�dd�|�dd�|�dd�|�td�d�|�td�d�|�dd�|�dd�|�dd�|�td�d�|�td�d�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�d	d�|�d	d�|�d
d�|�d
d�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�dD]F}dD]:}|�||t|�|�|�||tt|�|���q,�q$dD�]}dD�]�}|�||@tt|�t|�@��|�||Btt|�t|�B��|�||Att|�t|�A��|�|t|�@t|�t|�@�|�|t|�@tt|�t|�@��|�|t|�Bt|�t|�B�|�|t|�Btt|�t|�B��|�|t|�At|�t|�A�|�|t|�Att|�t|�A��|�t|�|@t|�t|�@�|�t|�|@tt|�t|�@��|�t|�|Bt|�t|�B�|�t|�|Btt|�t|�B��|�t|�|At|�t|�A�|�t|�|Att|�t|�A���qz�qp|�ddkd�|�ddkd�|�ddkd�|�ddkd�|�ddkd�|�ddkd�|�ddkd�|�ddkd�|�ddkd�|�ddkd�|�ddkd�|�ddkd�dg}|�||ud�|�||ud�|�d|vd�|�d|vd�|�d|vd�|�d|vd�ddi}|�||ud�|�||ud�|�d|vd�|�d|vd�|�d|vd�|�d|vd�|�dd�|�dd�dS)
NrFr%T��������r)r()FT)rr%r.)rr&�absr
r
�assertIs)r�b�i�a�xrrr�	test_math4s�$

    $ $ $ $ $ ,zBoolTest.test_mathcCs�|�ttdd�|�td�d�|�td�d�|�td�d�|�td�d�|�td�d�|�td	�d�|�t�d�dS)
N�*�
Tr%r,rFZhello�)rrr
r1r!rrr�test_convert�szBoolTest.test_convertcCs:|�td��tdd�Wd�n1s,0YdS)Nzkeyword argumentr8)r5)ZassertRaisesRegexrr
r!rrr�test_keyword_args�szBoolTest.test_keyword_argscCsD|�ddd�|�ddd�|�ddd�|�ddd�dS)Nz%dF�0T�1z%x)rr!rrr�test_format�szBoolTest.test_formatcCs(|�tgd�d�|�tgd�d�dS)N�appendTZwobbleF)r1�hasattrr!rrr�test_hasattr�szBoolTest.test_hasattrcCs$|�tt�d�|�td�d�dS)NTr%F)r1�callable�lenr!rrr�
test_callable�szBoolTest.test_callablecCsp|�tdt�d�|�tdt�d�|�tdt�d�|�tdt�d�|�tdt�d�|�tdt�d�dS)NTFr%r)r1�
isinstancer
r
r!rrr�test_isinstance�szBoolTest.test_isinstancecCs(|�ttt�d�|�ttt�d�dS)NTF)r1�
issubclassr
r
r!rrr�test_issubclass�szBoolTest.test_issubclasscCs(|�divd�|�dddivd�dS)Nr%FT)r1r!rrr�
test_contains�szBoolTest.test_containscCs�|�d�d�d�|�d�d�d�|�d��d�|�d��d�|�d��d�|�d��d�|�d��d�|�d��d�|�d��d�|�d	��d�|�d��d�|�d��d�|�d��d�|�d��d�|�d
��d�|�d��d�|�d��d�|�d	��d�|�d
�	�d�|�d�	�d�|�d	�
�d�|�d�
�d�|�d�d�d�|�d�d�d�dS)NZxyz�zTr5FZxyz0123z@#$%Z0123ZXYZ� � u �X)r1�endswith�isalnum�isalpha�isdigit�islower�	isdecimal�	isnumeric�isspace�istitle�isupper�
startswithr!rrr�test_string�s0zBoolTest.test_stringcCsp|�dd�|�dt�|�dd�|�dd�|�dt�|�dd�|�dd�|�dt�|�dd�dS)Nr%TrF)rZassertNotIsInstancer
r1r!rrr�test_boolean�szBoolTest.test_booleanc	CslzXttjd��}|�|jd�Wd�n1s20Y|�|jd�Wt�tj�nt�tj�0dS)NrFT)rrrr1�closedrr)r�frrr�test_fileclosed�s
,zBoolTest.test_fileclosedcCs4tttttttttt	t
fD]}|�t|�d�qdS)NT)r
�complex�dictr*r
�list�object�setr#�tuple�typer1)r�trrr�
test_types�s�zBoolTest.test_typescCs�ddl}|�|�d�d�|�|�d�d�|�|�d�d�|�|�d�d�|�|�gd�d�|�|�dgd�d�|�|�dd�d�|�|�dd�d�|�|�dd�d�|�|�dd�d�|�|�dd�d�|�|�dd�d�dS)NrFr%T)�operatorr1�truth�not_�contains�lt�is_�is_not)rrgrrr�
test_operatorszBoolTest.test_operatorcCs<ddl}|�|�|�d��d�|�|�|�d��d�dS)NrTF)�marshalr1�loads�dumps)rrorrr�test_marshalszBoolTest.test_marshalc	CsTddl}t|jd�D]8}|�|�|�d|��d�|�|�|�d|��d�qdS)Nrr%TF)�pickle�rangeZHIGHEST_PROTOCOLr1rprq)rrs�protorrr�test_pickleszBoolTest.test_picklecCs�ddl}|�|jddd�d�|�|jddd�d�|�|jddd�d�|�|jddd�d�|�|jddd�d	�|�|jddd�d
�dS)NrT)ZprotocolsI01
.FsI00
.r%r.s��.s��.)rsrrq)rrsrrr�test_picklevaluesszBoolTest.test_picklevaluescs��fdd�}Gdd�dt�}||��Gdd�dt�}||��Gdd�dt�}||��Gd	d
�d
t�}||��Gdd�d�}��tt|��dS)
Ncs��tt|�S�N�rrr
)�or!rr�<lambda>*�z/BoolTest.test_convert_to_bool.<locals>.<lambda>c@seZdZdd�ZdS)z*BoolTest.test_convert_to_bool.<locals>.FoocSs|Srxrr!rrr�__bool__,sz3BoolTest.test_convert_to_bool.<locals>.Foo.__bool__N�rrrr}rrrr�Foo+src@seZdZdd�ZdS)z*BoolTest.test_convert_to_bool.<locals>.BarcSsdS)NZYesrr!rrrr}1sz3BoolTest.test_convert_to_bool.<locals>.Bar.__bool__Nr~rrrr�Bar0sr�c@seZdZdd�ZdS)z*BoolTest.test_convert_to_bool.<locals>.BazcSs|Srxrr!rrrr}6sz3BoolTest.test_convert_to_bool.<locals>.Baz.__bool__Nr~rrrr�Baz5sr�c@seZdZdd�ZdS)z+BoolTest.test_convert_to_bool.<locals>.SpamcSsdS)Nr%rr!rrrr}<sz4BoolTest.test_convert_to_bool.<locals>.Spam.__bool__Nr~rrrr�Spam;sr�c@seZdZdd�ZdS)z+BoolTest.test_convert_to_bool.<locals>.EggscSsdS)Nr,rr!rrr�__len__Asz3BoolTest.test_convert_to_bool.<locals>.Eggs.__len__N�rrrr�rrrr�Eggs@sr�)rar
r�
ValueErrorr
)rZcheckrr�r�r�r�rr!r�test_convert_to_bool&s



zBoolTest.test_convert_to_boolcCs,|�t�dd�d�|�t�dd�d�dS)NsZbigFsabcd�littleT)r1r
�
from_bytesr!rrr�test_from_bytesEszBoolTest.test_from_bytescs�dD]��G�fdd�d�}zt|��Wqty�}zTzt|��Wn8ty~}z |�t|�t|��WYd}~n
d}~00WYd}~qd}~00qdS)N)Zillegalr,lcseZdZ�fdd�ZdS)z!BoolTest.test_sane_len.<locals>.Acs�Srxrr!�Zbadvalrrr�Nsz)BoolTest.test_sane_len.<locals>.A.__len__Nr�rr�rr�AMsr�)r
�	ExceptionrCrr#)rr�Ze_boolZe_lenrr�r�
test_sane_lenIszBoolTest.test_sane_lencCs@Gdd�d�}|�tt|��Gdd�d�}|�tt|��dS)Nc@seZdZdZdS)z BoolTest.test_blocked.<locals>.ANr~rrrrr�Ysr�c@seZdZdd�ZdZdS)z BoolTest.test_blocked.<locals>.BcSsdS)Nr8rr!rrrr�^sz(BoolTest.test_blocked.<locals>.B.__len__N)rrrr�r}rrrr�B]sr�ry)rr�r�rrr�test_blockedXszBoolTest.test_blockedcCs�|�djd�|�djd�|�tdj�t�|�tdj�t�|�djd�|�djd�|�tdj�t�|�tdj�t�dS)NTr%rF)r�real�imagr1rdr
r!rrr�test_real_and_imagcszBoolTest.test_real_and_imagN)rrrrrr"r$r'r+r6r:r;r>rArDrFrHrIrYrZr]rfrnrrrvrwr�r�r�r�r�rrrrrs8	m


r�__main__)Zunittest�testrrZTestCaserr�mainrrrr�<module>sh