Your IP : 13.58.214.43


Current Path : /opt/alt/python36/lib64/python3.6/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/idle_test/__pycache__/test_text.cpython-36.pyc

3

� fB�@svdZddlZddlmZddlmZGdd�de�ZGdd�deej�Z	Gd	d
�d
eej�Z
edkrrejdd
d�dS)zi Test mock_tk.Text class against tkinter.Text class

Run same tests with both by creating a mixin class.
�N)�requires)�TclErrorc@sleZdZdZdZedZdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�TextTestz*Define items common to both sets of tests.zhello
world�
cCs,|j|jjd�d�|j|jjd�d�dS)Nz1.0r�end�)�assertEqual�text�get)�self�r�@/opt/alt/python36/lib64/python3.6/idlelib/idle_test/test_text.py�	test_initszTextTest.test_initcCsH|jj}xdD]}|j||�d�qWxdD]}|j||�d
�q,WdS)Ng�?�333333�?�1.-1�1.0�1.0 lineend�1.end�1.33�insertr�@�2.1�33.44z2.0��)rrrrrrrr)rrrr)r	�indexr)rr�dexrrr
�test_index_emptys
zTextTest.test_index_emptycCsv|jj}|jjd|j�xd
D]}|j||�d�qWxdD]}|j||�d�q<WxdD]}|j||�d�qZWdS)N�1.0g�?�333333�?�1.-1�1.0 lineend�1.end�1.33z1.5r�33.44z3.0��)r$rrr)r r!r")rr#)r	rr�hwr)rrrrrr
�test_index_data s


zTextTest.test_index_datacCs�|jj}|j}|jjd|j�||d�d�||dd�d�||d�d�||dd�d�||dd�d�||dd�d�||dd	�d
�||dd�d
�||d	�d�||dd
�d�||dd�|j�||dd�|j�||dd�|j�dS)Nz1.0rr�hz1.1z1.3ZhelZelz1.0 lineend�helloz1.10rz2.3zello
worz2.5z0.0z5.0)r	r
rrr%�hwn)rr
�Equalrrr
�test_get-s zTextTest.test_getcCs�|jj}|jj}|j}|d|j�||dd�|j�|dd�||dd�|j�|dd�||dd�d�|dd�||dd�d�|dd�||dd�d	�|dd
�||dd�d�|dd
�||dd�d�dS)Nz1.0rr�*z
*hello
world
z1.0 lineendz*hello*
world
z2.3z*hello*
wor*ld
�xz*hello*
wor*ldx
z1.4zx
z*helx
lo*
wor*ldx
)r	rr
rr%r))rrr
r*rrr
�test_insert@s"





zTextTest.test_insertcCs�|jj}|jj}|j}|jjd|j�|d�||dd�|j�|d�||dd�|j�|dd�||dd�|j�|dd�||dd�|j�|dd�||dd�|j�|dd�||dd�|j�dS)Nz1.0rrz5.5z1.4)r	�deleter
rrr%r))rr/r
r*rrr
�test_no_deleteZs 



zTextTest.test_no_deletecCs�|jj}|jj}|j}|jjd|j�|d�||dd�d�|dd�||dd�d�|d�||dd�d�|jjdd�|d	�||dd�d�|jjdd�|dd
�||dd�d�dS)Nz1.0z1.endZelloz1.1ZlloZlloworldz1.3rz1.10z2.0)r	r/r
rrr%)rr/r
r*rrr
�test_delete_charss 

zTextTest.test_delete_charcCs�|jj}|jj}|j}|jjd|j�|dd�||dd�d�|dd�||dd�d�|jjd|j�|dd�||dd�d�|dd�||dd�d�|jjd|j�|dd	�||dd�d
�dS)Nz1.0z1.0 lineendrz
world
rz2.0zworld
z1.2z2.3zheld
)r	r/r
rrr%)rr/r
r*rrr
�test_delete_slice�s 




zTextTest.test_delete_slicecCsZ|jjdd�|jjdd�|j|jjdd�d�|jjdd�|j|jjdd�d�dS)	Nz1.0r(z1.3z	1
2
3
4
5rzhel1
2
3
4
5lo
z5.1zhello
)r	rrr
r/)rrrr
�test_multiple_lines�s
zTextTest.test_multiple_linesc	Cs�|jj}|j}|jjdd�|jt|ddd�x|dD]t\}}}}}}||d
|d�||�||d|d�||�||d|d�||�||d|d�||�||d|d�||�q4WdS)Nz1.0zFirst
Second
Third
z2.2�op�<TF�<=�>�>=�==�!=z1.1z2.1z2.3z3.3�r5TTFFF�r6TTTFF�r7FFFTT�r8FFTTT�r9FFTFF�r:TTFTT)r;r<r=r>r?r@)r	�comparerrZassertRaisesr)	rrAr*r4Zless1Zless0ZequalZgreater0Zgreater1rrr
�test_compare�s zTextTest.test_compareN)�__name__�
__module__�__qualname__�__doc__r%r)rrr&r+r.r0r1r2r3rBrrrr
r	s

	rc@s(eZdZedd��Zdd�Zdd�ZdS)�MockTextTestcCsddlm}||_dS)Nr)�Text)Zidlelib.idle_test.mock_tkrH)�clsrHrrr
�
setUpClass�szMockTextTest.setUpClasscCs|j�|_dS)N)rHr	)rrrr
�setUp�szMockTextTest.setUpcCsb|jj}|j}|jjd|j�||dd	�d
�||dd�d�||dd�d
�||dd�d�dS)Nz1.0r���z3.1r����)rMrNrP)rMrN)rMrO)rMrO)r	Z_decoderrr%)r�decoder*rrr
�test_decode�szMockTextTest.test_decodeN)rCrDrE�classmethodrJrKrRrrrr
rG�srGc@s,eZdZedd��Zedd��Zdd�ZdS)�
TkTextTestcCs*td�ddlm}m}||_|�|_dS)NZguir)�TkrH)rZtkinterrUrH�root)rIrUrHrrr
rJ�szTkTextTest.setUpClasscCs|jj�|`dS)N)rVZdestroy)rIrrr
�
tearDownClass�s
zTkTextTest.tearDownClasscCs|j|j�|_dS)N)rHrVr	)rrrr
rK�szTkTextTest.setUpN)rCrDrErSrJrWrKrrrr
rT�srT�__main__rMF)�	verbosity�exit)
rFZunittestZtest.supportrZ_tkinterr�objectrZTestCaserGrTrC�mainrrrr
�<module>s:

?>