Your IP : 3.23.102.79


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_undodelegator.cpython-35.pyc



��Yf��@s�dZddlmZed�ddlZddlmZddlmZmZddl	m
Z
ddlmZGd	d
�d
ej
�Zedkr�ejdd
dd�dS)zSUnittest for UndoDelegator in idlelib.UndoDelegator.

Coverage about 80% (retest).
�)�requiresZguiN)�Mock)�Text�Tk)�
UndoDelegator)�
Percolatorc@s�eZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dS)�UndoDelegatorTestcCs4t�|_t|j�|_t|j�|_dS)N)r�rootr�textr�
percolator)�cls�r
�I/opt/alt/python35/lib64/python3.5/idlelib/idle_test/test_undodelegator.py�
setUpClassszUndoDelegatorTest.setUpClasscCs3|jjj�|`|`|jj�|`dS)N)rZredir�closer
r	Zdestroy)rr
r
r�
tearDownClasss
zUndoDelegatorTest.tearDownClasscCs>t�|_|jj|j�td|jj�|j_dS)N�wraps)r�	delegatorrZinsertfilterr�bell)�selfr
r
r�setUpszUndoDelegatorTest.setUpcCs7|jj|j�|jjdd�|jj�dS)Nz1.0�end)rZremovefilterrr
�deleteZ
resetcache)rr
r
r�tearDown#szUndoDelegatorTest.tearDowncCsD|j}|jdd�|jdd�|jd�|j|jdd�d�|jdd�|jdd	�|jd
d�|jdd�|jd�|j|jdd�d
�|jd�|j|jdd�d�|jd�|j|jdd�d�|jd�|jjd�|j|jj	j
�dS)N�insertZfoobar�hz<<undo>>z1.0r�
�foo�barz1.2z1.4ZhelloZfoarz1.6z1.3Zevent)r
r�event_generate�assertEqual�getrrZ
undo_event�
assertTruer�called)rr
r
r
r�test_undo_event(s$	




z!UndoDelegatorTest.test_undo_eventcCs�|j}|jdd�|jdd�|jdd�|jd�|jd�|j|jdd�d�|jd�|j|jjj	�dS)Nrrrz1.0z1.3z<<undo>>z<<redo>>)
r
rrrr r!r"rrr#)rr
r
r
r�test_redo_event>s	


z!UndoDelegatorTest.test_redo_eventcCs�|j}|j}|jdd�|jdd�|jdd�|j|j|jfd�|jd�|j|j|jfd
�dS)z�
        Dump_event cannot be tested directly without changing
        environment variables. So, test statements in dump_event
        indirectly
        rrrz1.2z1.4�Tz<<undo>>�FN)r&T)r'F)r
rrrZassertTupleEqual�pointerZ	can_merger)rr
�dr
r
r�test_dump_eventJs		
z!UndoDelegatorTest.test_dump_eventcCs�|j}|j|j��|jjdd�|j|j��t�|_|jd�|j	|j
|j�|j|jj�|jd�|j	|jd�|j|jj�dS)Nr�aTF����)
rr"Z	get_savedr
rZassertFalserZsaved_change_hookZ	set_savedr r(Zsavedr#)rr)r
r
r�test_get_set_savedZs	

z$UndoDelegatorTest.test_get_set_savedcCs�|j}|jdd�|jj�|jdd�|jdd�|jj�|j|jdd�d�|jj�|jdd�|jj�|j|jdd�d�dS)Nrrrz1.0z1.3)r
rrZundo_block_startZundo_block_stopr r!)rr
r
r
r�test_undo_start_stopms	



z&UndoDelegatorTest.test_undo_start_stopcCsd|j}d|j_}xDt|d�D]2}|jdd�|jt|jj�|�q*WdS)N�
rr)r
r�max_undo�rangerZassertLessEqual�lenZundolist)rr
r1�ir
r
r�test_addcmd~s
	zUndoDelegatorTest.test_addcmdN)�__name__�
__module__�__qualname__�classmethodrrrrr$r%r*r.r/r5r
r
r
rrsr�__main__�	verbosityr'�exitF)�__doc__Ztest.supportrZunittestZ
unittest.mockrZtkinterrrZidlelib.UndoDelegatorrZidlelib.PercolatorrZTestCaserr6�mainr
r
r
r�<module>s
w

?>