HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/idlelib/idle_test/__pycache__/test_outwin.cpython-310.pyc
o

�i.�@s�dZddlmZddlZddlmZddlmZmZddl	m
Z
ddlmZddlm
Z
Gd	d
�d
ej�ZGdd�dej�Zed
krJejdd�dSdS)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�}|_|��t�ddd|�}|_t|�|_|_dS)NZgui)	rr�rootZwithdrawrZOutputWindow�windowr�text)�clsr
�w�r�:/usr/local/lib/python3.10/idlelib/idle_test/test_outwin.py�
setUpClasss
zOutputWindowTest.setUpClasscCs$|j��|`|`|j��|`dS�N)r�closerr
Zdestroy�r
rrr�
tearDownClasss

zOutputWindowTest.tearDownClasscCs|j�dd�dS)N�1.0�end)r�delete��selfrrr�setUpszOutputWindowTest.setUpcCs*|j}|�|�d��|�|�t��dS)Nztest.txt)rZassertFalseZispythonsource�__file__)rrrrr�test_ispythonsource sz$OutputWindowTest.test_ispythonsourcecCs|�|jj��d�dS)NZOutput)�assertEqualr�top�titlerrrr�test_window_title&sz"OutputWindowTest.test_window_titlecCsd|j}|j}t�|_d|j_||��d�||jjd�d|j_||��d�||jjd�|`dS)NF�no�TZyes�)rrrZ	get_saved�resultZ	maybesave�called)rr�eqrrr�test_maybesave)szOutputWindowTest.test_maybesavecCs||j}|jj}|jj}|jj}|dd�d}|||�t|��||dd�d�||dd�d�|dd�d}|||�t|��||dd�d�||dd�d�|dd�d	}|||�t|��||dd�d�||d
d�d�||dd�d�|dd�d}d
}|||dd�t|��|||dd�t|��||dd�|�||dd�|�||dd�|�d��||d
d�|�d��dS)Nrrz	test text�1.end�insert linestart�insert lineendz
test text
�ztest text
Line 2�2.0�2.end�Line 2�Line 2
Zmytag)�tagsZ	secondtagzmytag.firstz
mytag.lastzsecondtag.firstzsecondtag.last�
)rrr�getr�write�len�rstrip)rr'rr3r4Z	test_textZ
test_text2rrr�
test_write7s:



zOutputWindowTest.test_writecCsb|j}|jj}|jj}|d�||dd�d�||dd�d�||dd	�d
�||dd�d
�dS)N)zLine 1
r0zLine 3
rr)zLine 1r-r.r/z3.0z3.endzLine 3r*r+r,)rrr3r�
writelines)rr'r3r8rrr�test_writelines^sz OutputWindowTest.test_writelinescCs
|j}|j}|j}t��|_t�}|j_t�}|_	|�
d�|�|���||j
d�||jd�|�
tt��d��|�
tt��d��|�|���||jtt�df�|�dd�|�
tt��d��|�
d�|�|���||jtt�d	f�|j`|`	dS)
NzNot a file linerzNo special linez: 42: spam
z
: 21: spam�rr�*)rrrrZMock�flistrZgotofileliner�	showerrorr4ZassertIsNoneZgoto_file_liner&r �strr�argsr)rr'rrZgflr=rrr�test_goto_file_lineis(


z$OutputWindowTest.test_goto_file_lineN)
�__name__�
__module__�__qualname__�classmethodrrrrr!r(r7r9r@rrrrr	s

'r	c@s2eZdZedd��Zdd�Ze�d�dd��ZdS)	�ModuleFunctionTestcCs
dt_dSr)r�file_line_progsrrrrr�s
zModuleFunctionTest.setUpcCs2t��ttjtj�D]\}}|�|j|�qdSr)rZ
compile_progs�zipZfile_line_patsrFr�pattern)r�patZregexrrr�test_compile_progs�s�z%ModuleFunctionTest.test_compile_progsz
builtins.opencCs@tj}d}|D]\}}|�||�|�|r|�|dd�qdS)N))z"foo file "testfile1", line 42, bar)Z	testfile1r;)zfoo testfile2(21) bar)Z	testfile2r:)z  testfile3  : 42: foo bar\n)z
  testfile3  r;)zfoo testfile4.py :1: )zfoo testfile4.py r#)utestfile5: ᧔᧒: )Z	testfile5r;)z
testfile6: 42N)ztestfile7 42 textNr�r)rZfile_line_helperrZassert_called_with)rZ	mock_openZflhZ
test_lines�lineZexpected_outputrrr�test_file_line_helper�s	��z(ModuleFunctionTest.test_file_line_helperN)	rArBrCrDrrJrZpatchrMrrrrrE�s
rE�__main__r$)�	verbosity)�__doc__ZidlelibrZunittestZtest.supportr�tkinterrrZidlelib.idle_test.mock_tkrZidlelib.idle_test.mock_idlerrZTestCaser	rErA�mainrrrr�<module>s|�