HEX
Server: Apache
System: Linux bd12.noc223.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: handcraf (1693)
PHP: 8.1.28
Disabled: NONE
Upload Files
File: //opt/alt/python312/lib64/python3.12/idlelib/idle_test/__pycache__/test_outwin.cpython-312.pyc
�

}h�e)����dZddlmZddlZddlmZddlmZmZddl	m
Z
ddlmZddlm
Z
Gd	�d
ej�ZGd�dej�Zed
k(rej$d��yy)zTest outwin, coverage 76%.�)�outwinN)�requires)�Tk�Text)�	Mbox_func)�Func)�mockc�V�eZdZed��Zed��Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zy
)�OutputWindowTestc���td�t�x}|_|j�t	j
ddd|�x}|_t|�x|_|_y)N�gui)	rr�root�withdrawr�OutputWindow�windowr�text)�clsr�ws   �D/opt/alt/python312/lib64/python3.12/idlelib/idle_test/test_outwin.py�
setUpClasszOutputWindowTest.setUpClasssO������$���s�x��
�
���,�,�T�4��t�D�D��C�J� ��J�&���1�6�c�x�|jj�|`|`|jj	�|`y�N)r�closerr�destroy�rs r�
tearDownClasszOutputWindowTest.tearDownClasss0���
�
�����H�c�j��������Hrc�<�|jjdd�y)N�1.0�end)r�delete��selfs r�setUpzOutputWindowTest.setUps���	�	�����&rc��|j}|j|jd��|j|jt��y)Nztest.txt)r�assertFalse�ispythonsource�__file__)r#rs  r�test_ispythonsourcez$OutputWindowTest.test_ispythonsource s=���K�K������)�)�*�5�6�����)�)�(�3�4rc�l�|j|jjj�d�y)N�Output)�assertEqualr�top�titler"s r�test_window_titlez"OutputWindowTest.test_window_title&s#����������.�.�0�(�;rc�j�|j}|j}t�|_d|j_||j�d�||jjd�d|j_||j�d�||jjd�|`y)NF�no�T�yes�)rr,r�	get_saved�result�	maybesave�called)r#r�eqs   r�test_maybesavezOutputWindowTest.test_maybesave)s����K�K��
�
�
���f���"�����
�1�;�;�=�$��
�1�;�;���q�!�!�����
�1�;�;�=�%� �
�1�;�;���q�!�
�Krc��|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
}|||d��t
|��|||d��t
|��||dd�|�||dd�|�||dd�|jd��||d
d�|jd��y)Nrr z	test text�1.end�insert linestart�insert lineendz
test text
�ztest text
Line 2�2.0�2.end�Line 2�Line 2
�mytag)�tags�	secondtagzmytag.firstz
mytag.lastzsecondtag.firstzsecondtag.last�
)r,rr!�getr�write�len�rstrip)r#r9r!rHrI�	test_text�
test_text2s       r�
test_writezOutputWindowTest.test_write7s���
�
�
�����!�!���i�i�m�m�����!�!��	�u�e���	�
�5���S��^�,�
�3�u�g���,�
�3�!�#3�4�k�B�	�u�e��!�	�
�5���S��^�,�
�3�u�g���,�
�3�!�#3�4�b�9�	�u�e��'�	�
�5���S��^�,�
�3�u�g���,�
�3�u�g���)�
�3�!�#3�4�h�?�	�u�e��!�	��
�
�5���)�3�y�>�:�
�5��+�.��J��@�
�3�}�l�+�Y�7�
�3� �"2�3�Z�@�
�3�u�g��	� 0� 0�� 6�7�
�3�u�g��
� 1� 1�$� 7�8rc��|j}|jj}|jj}|d�||dd�d�||dd�d�||dd	�d
�||dd�d
�y)N)zLine 1
rCzLine 3
rr<zLine 1r@rArBz3.0z3.endzLine 3r=r>r?)r,rrHr�
writelines)r#r9rHrPs    r�test_writelinesz OutputWindowTest.test_writelines^sx��
�
�
���i�i�m�m���[�[�+�+�
��7�8�
�3�u�g���)�
�3�u�g���)�
�3�u�g���)�
�3�!�#3�4�b�9rc��|j}|j}|j}tj�|_t
�x}|j
_t�x}|_	|jd�|j|j��||jd�||jd�|jtt ��d��|jtt ��d��|j|j��||j"tt �df�|j%dd�|jtt ��d��|jd�|j|j��||j"tt �d	f�|j
`|`	y)
NzNot a file linerzNo special linez: 42: spam
z
: 21: spam�rr �*)r,rrr	�Mock�flistr�gotofileliner�	showerrorrI�assertIsNone�goto_file_liner8r.�strr(�argsr!)r#r9rr�gflrXs      r�test_goto_file_linez$OutputWindowTest.test_goto_file_lineis^��
�
�
���K�K���y�y���)�)�+���%)�V�+��a�g�g�"�"+�+�-�	�A�K�	
���!�"����!�*�*�,�-�
�3�:�:�q��
�9�?�?�-�.�	
���3�x�=�/��.�/�	���3�x�=�/��,�-����!�*�*�,�-�
�3�8�8�c�(�m�R�(�)�	
���E�5�!�	���3�x�=�/��.�/�	���!�"����!�*�*�,�-�
�3�8�8�c�(�m�R�(�)�
�G�G� �!�+rN)
�__name__�
__module__�__qualname__�classmethodrrr$r)r/r:rNrQr^�rrrrsL���'��'�����'�5�<��%9�N	:�.rrc�R�eZdZed��Zd�Zejd�d��Zy)�ModuleFunctionTestc��dt_yr)r�file_line_progsrs rr$zModuleFunctionTest.setUp�s
��!%��rc���tj�ttjtj�D]!\}}|j|j|��#yr)r�
compile_progs�zip�file_line_patsrgr,�pattern)r#�pat�regexs   r�test_compile_progsz%ModuleFunctionTest.test_compile_progs�sH�������f�3�3�V�5K�5K�L�	1�J�C�����U�]�]�C�0�	1rz
builtins.openc��tj}d}|D]4\}}|j||�|�|s�!|j|d��6y)N))z"foo file "testfile1", line 42, bar)�	testfile1rT)zfoo testfile2(21) bar)�	testfile2rS)z  testfile3  : 42: foo bar\n)z
  testfile3  rT)zfoo testfile4.py :1: )zfoo testfile4.py r2)utestfile5: ᧔᧒: )�	testfile5rT)z
testfile6: 42N)ztestfile7 42 textNr)r�file_line_helperr,�assert_called_with)r#�	mock_open�flh�
test_lines�line�expected_outputs      r�test_file_line_helperz(ModuleFunctionTest.test_file_line_helper�sV���%�%���
�&0�	A�!�D�/����S��Y��8���,�,�_�Q�-?�@�	ArN)	r_r`rarbr$ror	�patchr{rcrrrere�s:���&��&�1�
�T�Z�Z�� �A�!�Arre�__main__r4)�	verbosity)�__doc__�idlelibr�unittest�test.supportr�tkinterrr�idlelib.idle_test.mock_tkr�idlelib.idle_test.mock_idlerr	�TestCaserrer_�mainrcrr�<module>r�sc�����!��/�,��y.�x�(�(�y.�xA��*�*�A�:�z���H�M�M�A��r