Your IP : 18.189.194.225


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_undo.cpython-36.pyc

3

� f��@s�dZddlmZddlZddlmZed�ddlmZddlm	Z	m
Z
ddlmZGd	d
�d
ej
�Zedkr|ejdd
d�dS)zTest undo, coverage 77%.�)�
UndoDelegatorN)�requiresZgui)�Mock)�Text�Tk)�
Percolatorc@sdeZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dS)�UndoDelegatorTestcCs$t�|_t|j�|_t|j�|_dS)N)r�rootr�textr�
percolator)�cls�r
�@/opt/alt/python36/lib64/python3.6/idlelib/idle_test/test_undo.py�
setUpClassszUndoDelegatorTest.setUpClasscCs&|jjj�|`|`|jj�|`dS)N)rZredir�closer
r	Zdestroy)rr
r
r�
tearDownClasss
zUndoDelegatorTest.tearDownClasscCs$t�|_t�|j_|jj|j�dS)N)r�	delegatorr�bellrZinsertfilter)�selfr
r
r�setUps
zUndoDelegatorTest.setUpcCs*|jj|j�|jjdd�|jj�dS)Nz1.0�end)rZremovefilterrr
�deleteZ
resetcache)rr
r
r�tearDown"szUndoDelegatorTest.tearDowncCs�|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_eventcCsp|j}|jdd�|jdd�|jdd�|jd�|jd�|j|jdd�d�|jd�|j|jjj	�dS)Nrrrz1.0z1.3z<<undo>>z<<redo>>)
r
rrrrr r!rrr")rr
r
r
r�test_redo_event=s


z!UndoDelegatorTest.test_redo_eventcCsf|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_eventIs
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_savedrr'Zsavedr")rr(r
r
r�test_get_set_savedYs

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_stoprr )rr
r
r
r�test_undo_start_stopls



z&UndoDelegatorTest.test_undo_start_stopcCsL|j}d|j_}x4t|d�D]$}|jdd�|jt|jj�|�q WdS)N�
rr)r
r�max_undo�rangerZassertLessEqual�lenZundolist)rr
r0�ir
r
r�test_addcmd}s
zUndoDelegatorTest.test_addcmdN)�__name__�
__module__�__qualname__�classmethodrrrrr#r$r)r-r.r4r
r
r
rrsr�__main__r&F)�	verbosity�exit)�__doc__Zidlelib.undorZunittestZtest.supportrZ
unittest.mockrZtkinterrrZidlelib.percolatorrZTestCaserr5�mainr
r
r
r�<module>sx

?>