Your IP : 3.22.68.29


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/idle_test/__pycache__/test_text.cpython-35.pyc



��YfS�@s�ddlZddlmZddlmZGdd�de�ZGdd�deej�ZGdd	�d	eej�Z	e
d
kr�ejddd
d�dS)�N)�requires)�TclErrorc@s�eZdZdZedZdZdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�TextTestzhello
world�
NcCs|j�|_dS)N)�Text�text)�self�r	�@/opt/alt/python35/lib64/python3.5/idlelib/idle_test/test_text.py�setUp
szTextTest.setUpcCs<|j|jjd�d�|j|jjd�d�dS)Nz1.0r�end�)�assertEqualr�get)rr	r	r
�	test_initszTextTest.test_initcCs^|jj}x$dD]}|j||�d�qWx$dD]}|j||�d
�q:WdS)Ng�?�333333�?�1.-1�1.0�1.0 lineend�1.end�1.33�insertr�@�2.1�33.44z2.0��)rrrrrrrr)rrrr)r�indexr)rr�dexr	r	r
�test_index_emptys

zTextTest.test_index_emptycCs�|jj}|jjd|j�x$d
D]}|j||�d�q)Wx$dD]}|j||�d�qPWx$dD]}|j||�d�qwWdS)N�1.0g�?�333333�?�1.-1�1.0 lineend�1.end�1.33z1.5r�33.44z3.0��)r&r r!r)r"r#r$)rr%)rrr�hwr)rrrr	r	r
�test_index_datas


zTextTest.test_index_datacCsM|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.0rr
�hz1.1z1.3ZhelZelz1.0 lineend�helloz1.10rz2.3zello
worz2.5z0.0z5.0)rrrrr'�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.0rr
�*z
*hello
world
z1.0 lineendz*hello*
world
z2.3z*hello*
wor*ld
�xz*hello*
wor*ldx
z1.4zx
z*helx
lo*
wor*ldx
)rrrrr'r+)rrrr,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.0rrz5.5z1.4)r�deleterrrr'r+)rr1rr,r	r	r
�test_no_deleteXs 	





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)rr1rrrr')rr1rr,r	r	r
�test_delete_charqs 	




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 lineendrz
world
rz2.0zworld
z1.2z2.3zheld
)rr1rrrr')rr1rr,r	r	r
�test_delete_slice�s 	




zTextTest.test_delete_slicecCs{|jjdd�|jjdd�|j|jjdd�d�|jjdd�|j|jjdd�d�dS)	Nz1.0r*z1.3z	1
2
3
4
5rzhel1
2
3
4
5lo
z5.1zhello
)rrrrr1)rr	r	r
�test_multiple_lines�s
zTextTest.test_multiple_linesc	Cs�|jj}|j}|jjdd�|jt|ddd�x�dD]�\}}}}}}||d
|d�||�||d|d�||�||d|d�||�||d|d�||�||d|d�||�qHWdS)Nz1.0zFirst
Second
Third
z2.2�op�<TF�<=�>�>=�==�!=z1.1z2.1z2.3z3.3�r7TTFFF�r8TTTFF�r9FFFTT�r:FFTTT�r;FFTFF�r<TTFTT)r=r>r?r@rArB)r�comparerrZassertRaisesr)	rrCr,r6Zless1Zless0ZequalZgreater0Zgreater1r	r	r
�test_compare�s 	zTextTest.test_compare)�__name__�
__module__�__qualname__r'r+rrrrr(r-r0r2r3r4r5rDr	r	r	r
rs


	rc@s.eZdZedd��Zdd�ZdS)�MockTextTestcCsddlm}||_dS)Nr)r)Zidlelib.idle_test.mock_tkr)�clsrr	r	r
�
setUpClass�szMockTextTest.setUpClasscCs�|jj}|j}|jjd|j�||dd	�d
�||dd�d�||dd�d
�||dd�d�dS)Nz1.0r���z3.1r����)rLrMrO)rLrM)rLrN)rLrN)rZ_decoderrr')r�decoder,r	r	r
�test_decode�s	zMockTextTest.test_decodeN)rErFrG�classmethodrJrQr	r	r	r
rH�srHc@s4eZdZedd��Zedd��ZdS)�
TkTextTestcCs9td�ddlm}m}||_|�|_dS)NZguir)�Tkr)rZtkinterrTr�root)rIrTrr	r	r
rJ�s
	zTkTextTest.setUpClasscCs|jj�|`dS)N)rUZdestroy)rIr	r	r
�
tearDownClass�s
zTkTextTest.tearDownClassN)rErFrGrRrJrVr	r	r	r
rS�srS�__main__�	verbosityrL�exitF)ZunittestZtest.supportrZ_tkinterr�objectrZTestCaserHrSrE�mainr	r	r	r
�<module>s�

?>