Your IP : 18.116.63.107


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

3

� f��@s�dZddlmZddlZddlmZddlmZmZddl	m
Z
ddlmZddlm
Z
Gd	d
�d
ej�ZGdd�dej�Zed
kr�ejdd�dS)zTest outwin, coverage 76%.�)�outwinN)�requires)�Tk�Text)�	Mbox_func)�Func)�mockc@s\eZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)�OutputWindowTestcCsFtd�t�}|_|j�tjddd|�}|_t|�|_|_dS)NZgui)	rr�rootZwithdrawrZOutputWindow�windowr�text)�clsr
�w�r�B/opt/alt/python36/lib64/python3.6/idlelib/idle_test/test_outwin.py�
setUpClasss
zOutputWindowTest.setUpClasscCs$|jj�|`|`|jj�|`dS)N)r�closerr
Zdestroy)r
rrr�
tearDownClasss

zOutputWindowTest.tearDownClasscCs|jjdd�dS)Nz1.0�end)r�delete)�selfrrr�setUpszOutputWindowTest.setUpcCs*|j}|j|jd��|j|jt��dS)Nztest.txt)rZassertFalseZispythonsource�__file__)rrrrr�test_ispythonsource sz$OutputWindowTest.test_ispythonsourcecCs|j|jjj�d�dS)NZOutput)�assertEqualr�top�title)rrrr�test_window_title&sz"OutputWindowTest.test_window_titlecCsd|j}|j}t�|_d|j_||j�d�||jjd�d|j_||j�d�||jjd�|`dS)NF�no�T�yes�)rrrZ	get_saved�resultZ	maybesave�called)rr�eqrrr�test_maybesave)szOutputWindowTest.test_maybesavecCs�|j}|jj}|jj}|jj}d}|||�t|��||dd�|j��|dd�d}|||�t|��||dd�d�||dd�d�|dd�d}|||�t|��||dd�d�||dd�d	�|dd�d
}|||�t|��||dd�d�||dd�d
�||dd�d
�|dd�d}d}|||dd�t|��|||dd�t|��||dd�|�||dd�|�||dd�|jd��||dd�|jd��dS)NsTest bytes.z1.0z1.endrz	test textzinsert linestartzinsert lineendz
test text
�ztest text
Line 2z2.0z2.endzLine 2zLine 2
Zmytag)ZtagsZ	secondtagzmytag.firstz
mytag.lastzsecondtag.firstzsecondtag.last�
)	rrr�getr�write�len�decode�rstrip)rr$rr(r)�bZ	test_textZ
test_text2rrr�
test_write7s@



zOutputWindowTest.test_writecCsb|j}|jj}|jj}|d�||dd�d�||dd�d	�||d
d�d�||d
d�d�dS)N�Line 1
�Line 2
�Line 3
z1.0z1.endzLine 1z2.0z2.endzLine 2z3.0z3.endzLine 3zinsert linestartzinsert lineendr&)r/r0r1)rrr(r�
writelines)rr$r(r2rrr�test_writelinescsz OutputWindowTest.test_writelinescCs
|j}|j}|j}tj�|_t�}|j_t�}|_	|j
d�|j|j��||j
d�||jd�|j
tt��d��|j
tt��d��|j|j��||jtt�df�|jdd�|j
tt��d��|j
d�|j|j��||jtt�d	f�|j`|`	dS)
NzNot a file linerzNo special linez: 42: spam
z
: 21: spam�z1.0r�*)rrrrZMockZflistrZgotofileliner�	showerrorr)ZassertIsNoneZgoto_file_liner#r�strr�argsr)rr$rrZgflr6rrr�test_goto_file_linens(


z$OutputWindowTest.test_goto_file_lineN)
�__name__�
__module__�__qualname__�classmethodrrrrrr%r.r3r9rrrrr	s,r	c@s2eZdZedd��Zdd�Zejd�dd��ZdS)	�ModuleFunctionTestcCs
dt_dS)N)r�file_line_progs)r
rrrr�szModuleFunctionTest.setUpcCs6tj�x(ttjtj�D]\}}|j|j|�qWdS)N)rZ
compile_progs�zipZfile_line_patsr?r�pattern)rZpatZregexrrr�test_compile_progs�sz%ModuleFunctionTest.test_compile_progsz
builtins.opencCsDtj}d}x4|D],\}}|j||�|�|r|j|dd�qWdS)N�"foo file "testfile1", line 42, bar�	testfile1r5�foo testfile2(21) bar�	testfile2r4�  testfile3  : 42: foo bar\n�
  testfile3  �foo testfile4.py :1: �foo testfile4.py r�testfile5: ᧔᧒: �	testfile5�
testfile6: 42�testfile7 42 textr�r�rDr5�rCrP�rFr4�rErR�rHr5�rGrT�rJr�rIrV�rLr5�rKrX�rMN�rNN)rQrSrUrWrYrZr[)rZfile_line_helperrZassert_called_with)rZ	mock_openZflhZ
test_lines�lineZexpected_outputrrr�test_file_line_helper�sz(ModuleFunctionTest.test_file_line_helperN)	r:r;r<r=rrBrZpatchr]rrrrr>�sr>�__main__r!)�	verbosity)�__doc__ZidlelibrZunittestZtest.supportrZtkinterrrZidlelib.idle_test.mock_tkrZidlelib.idle_test.mock_idlerrZTestCaser	r>r:�mainrrrr�<module>s

?>