Your IP : 3.145.92.96


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

3

� f�
�@s�dZddlmZddlmZed�ddlZddlmZddlm	Z	m
Z
Gdd	�d	�ZGd
d�dej�Z
edkr|ejd
d�dS)z�Test parenmatch, coverage 91%.

This must currently be a gui test because ParenMatch methods use
several text methods not defined on idlelib.idle_test.mock_tk.Text.
�)�
ParenMatch)�requiresZguiN)�Mock)�Tk�Textc@seZdZdd�ZdS)�DummyEditwincCs||_d|_d|_d|_dS)N�T)�textZindentwidthZtabwidthZcontext_use_ps1)�selfr	�r�F/opt/alt/python36/lib64/python3.6/idlelib/idle_test/test_parenmatch.py�__init__szDummyEditwin.__init__N)�__name__�
__module__�__qualname__r
rrrrrsrc@sLeZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�ParenMatchTestcCs8t�|_|jj�t|j�|_t|j�|_t�|j_dS)N)	r�rootZwithdrawrr	r�editwinrZ
text_frame)�clsrrr�
setUpClasss

zParenMatchTest.setUpClasscCs$|`|`|jj�|jj�|`dS)N)r	rrZupdate_idletasksZdestroy)rrrr�
tearDownClass!s

zParenMatchTest.tearDownClasscCs|jjdd�dS)Nz1.0�end)r	�delete)r
rrr�tearDown(szParenMatchTest.tearDowncCst|j�}dd�|_|S)NcSsdS)Nrrrrr�<lambda>-sz/ParenMatchTest.get_parenmatch.<locals>.<lambda>)rrZbell)r
�pmrrr�get_parenmatch+s

zParenMatchTest.get_parenmatchcCs�|j}|j�}�x�d D]�\}}}|j|d
���|jdd�||_|jd
d�|jd�|jd|j��|dkr�|j	|j
dd�d!�|j	|jdd�|�|jd
d�|j�|j
d|j��|j|jdd�f�|jd�|j	|jdd�|�WdQRXqWdS)"z2
        Test ParenMatch with each style.
        �opener�1.10�1.11�default�parens�1.14�1.15�1.16�
expression)�stylez1.0r�insertzdef foobar(a, b�eventz<<parenmatch-check-restore>>Zparen�)N�rr�rr�rr*r+�rr�rr�r r-r.�r"r#�r#r$�r!r0r1�rr#�rr$�r%r3r4)r,r/r2r5)rr)r	rZsubTestrZSTYLEr'�flash_paren_eventZassertInZ
event_infoZassertTupleEqualZ
tag_nextrangeZ
tag_prevrange�
restore_eventZassertNotInZassertEqual�paren_closed_event)r
r	rr&Zrange1Zrange2rrr�test_paren_styles0s4


z ParenMatchTest.test_paren_stylescCs^|j}|j�}|jdd�|jd�|jdd�|jd�|jd�|jdd�|jd�dS)z�
        Test corner cases in flash_paren_event and paren_closed_event.

        These cases force conditional expression and alternate paths.
        r'z# this is a commen)r(z
defz	 a, *arg)N)r	rr'r8r6)r
r	rrrr�test_paren_cornerRs


z ParenMatchTest.test_paren_cornercCsN|j�}t�|_|jd�|j|jj�|jj�|jd�|j|jj�dS)Nr�)rrr7Zhandle_restore_timerZ
assertTrueZcalledZ
reset_mockZassertFalse)r
rrrr�test_handle_restore_timeres


z(ParenMatchTest.test_handle_restore_timerN)rrr�classmethodrrrrr9r:r<rrrrrs"r�__main__�)�	verbosity)�__doc__Zidlelib.parenmatchrZtest.supportrZunittestZ
unittest.mockrZtkinterrrrZTestCaserr�mainrrrr�<module>sX

?>