HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/python38/lib/python3.8/idlelib/idle_test/__pycache__/test_textview.cpython-38.pyc
U

�i�_��@sdZddlmZddlmZed�ddlZddlZddlm	Z	m
Z
mZmZm
Z
ddlmZddlmZdd	lmZd
d�Zdd
�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�Zedk�rej dd�dS)aTest textview, coverage 100%.

Since all methods and functions create (or destroy) a ViewWindow, which
is a widget containing a widget, etcetera, all tests must be gui tests.
Using mock Text would not change this.  Other mocks are used to retrieve
information about calls.
�)�textview)�requiresZguiN)�Tk�TclError�CHAR�NONE�WORD)�Button)�Func)�	Mbox_funccCst�at��dS�N�r�root�withdraw�rr�>/opt/python38/lib/python3.8/idlelib/idle_test/test_textview.py�setUpModulesrcCst��t��bdSr�r�update_idletasks�destroyrrrr�tearDownModulesrc@seZdZe�Ze�Ze�ZdS)�VWN)�__name__�
__module__�__qualname__r
�	transient�grab_set�wait_windowrrrrr#src@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�ViewWindowTestcCs"tj��tj��tj��dSr)rr�__init__rr��selfrrr�setUp,s

zViewWindowTest.setUpcCsBttdd�}|�tjj�|�tjj�|�tjj�|��dS)N�Title�	test text)rr�
assertTruer�calledrr�ok�r!�viewrrr�test_init_modal1s
zViewWindowTest.test_init_modalcCsFttdddd�}|�tjj�|�tjj�|�tjj�|��dS�Nr#r$F��modal)rrZassertFalserr&rrr'r(rrr�test_init_nonmodal8s
z!ViewWindowTest.test_init_nonmodalcCs>ttdddd�}t�|_|��|�|jj�|`|��dSr+)rrr
rr'r%r&r(rrr�test_ok?szViewWindowTest.test_okN)rrrr"r*r.r/rrrrr*src@seZdZdd�ZdS)�AutoHideScrollbarTestcCs*t�t�}|�t|j�|�t|j�dSr)�tvZAutoHideScrollbarrZassertRaisesr�packZplace)r!Zscrollrrr�test_forbidden_geometryJs
z-AutoHideScrollbarTest.test_forbidden_geometryN)rrrr3rrrrr0Hsr0c@s@eZdZedd��Zedd��Zefdd�Zdd�Zd	d
�Z	dS)�ScrollableTextFrameTestcCst�|_}|��dSrr
��clsrrrr�
setUpClassRsz"ScrollableTextFrameTest.setUpClasscCs|j��|j��|`dSrr�r6rrr�
tearDownClassWs

z%ScrollableTextFrameTest.tearDownClasscs2tj|jfd|i|����fdd�}|�|��S)N�wrapcs������dSr)rrr��framerr�
cleanup_frame_sz9ScrollableTextFrameTest.make_frame.<locals>.cleanup_frame)r1ZScrollableTextFramer�
addCleanup)r!r:�kwargsr=rr;r�
make_frame]s
z"ScrollableTextFrameTest.make_framecCs0|��}|j�dd�|�|j�dd�d�dS)N�1.0r$�1.end)r@�text�insert�assertEqual�get)r!r<rrr�
test_line1esz"ScrollableTextFrameTest.test_line1c
Cs�|jtd�}|�|j�d�t�|�|j�ttfD]H}|j	|d��2|j|d�}|�|j�d�|�|�
|j�W5QRXq4dS)N)r:r:)r@rrErC�cgetZassertIsNotNoneZxscrollrrZsubTest�assertIsNone)r!r<r:rrr�test_horiz_scrollbarjsz,ScrollableTextFrameTest.test_horiz_scrollbarN)
rrr�classmethodr7r9rr@rGrJrrrrr4Ps

r4c@s,eZdZedd��Zedd��Zdd�ZdS)�
ViewFrameTestcCs&t�|_}|��t�|d�|_dS)Nr$)rrrr1�	ViewFramer<r5rrrr7~szViewFrameTest.setUpClasscCs |`|j��|j��|`dSr)r<rrrr8rrrr9�s

zViewFrameTest.tearDownClasscCs |jjj}|�|dd�d�dS)NrArBr$)r<rCrFrE)r!rFrrrrG�s
zViewFrameTest.test_line1N)rrrrKr7r9rGrrrrrL|s


rLc@sLeZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�ViewFunctionTestcCstj|_t�t_dSr)r1�	showerror�
orig_errorrr8rrrr7�szViewFunctionTest.setUpClasscCs|jt_|`dSr)rPr1rOr8rrrr9�szViewFunctionTest.tearDownClasscCs>tjtdddd�}|�|tj�|�|jtj�|j��dSr+)r1�	view_textr�assertIsInstance�
ViewWindow�	viewframerMr'r(rrr�test_view_text�szViewFunctionTest.test_view_textcCs\tjtdtddd�}|�|tj�|�|jtj�|jjj	j
}|�d|dd��|��dS)Nr#�asciiFr,ZTestrArB)
r1�	view_filer�__file__rRrSrTrM�	textframerCrFZassertInr')r!r)rFrrr�test_view_file�szViewFunctionTest.test_view_filecCs2tjtddddd�}|�|�|�tjjd�dS)Nr#zabc.xyzrVFr,zFile Load Error)r1rWrrIrErO�titler(rrr�
test_bad_file�s
zViewFunctionTest.test_bad_filecCsRtj}|�|�|�t�dd��}tjtd|ddd�}|�	|�|�
tjjd�dS)Nz..zCREDITS.txtr#rVFr,zUnicode Decode Error)
�os�path�abspath�join�dirnamerXr1rWrrIrErOr[)r!�p�fnr)rrr�test_bad_encoding�s

z"ViewFunctionTest.test_bad_encodingcCs4tjtddddd�}|jjj}|�|�d�d�dS)Nr#�testFZnone)r-r:r:)r1rQrrTrYrCrErH)r!r)Ztext_widgetrrr�test_nowrap�s
zViewFunctionTest.test_nowrapN)rrrrKr7r9rUrZr\rdrfrrrrrN�s

rNc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�ButtonClickTestcCsd|_d|_dS)NF)r)r&r rrrr"�szButtonClickTest.setUpcCs|jr|j��dSr)r)rr rrr�tearDown�szButtonClickTest.tearDowncsn�fdd�}ttd|d�}|����|j����jd����j��d����jj	j
j�dd�d	�dS)
Ncsd�_tjtdddd��_dS)NT�
TITLE_TEXT�COMMAND)�_utest)r&r1rQrr)rr rr�_command�szAButtonClickTest.test_view_text_bind_with_button.<locals>._command�BUTTON�rCZcommandTrirArBrj)
r	r�invoker>rrEr&r)r[rTrYrCrF)r!rl�buttonrr r�test_view_text_bind_with_button�s�z/ButtonClickTest.test_view_text_bind_with_buttonc	s��fdd�}ttd|d�}|����|j����jd����j��d��jj	j
jj}t
t��B}��|dd�|�����|����|d	d
�|�����W5QRXdS)Ncs d�_tjtdtddd��_dS)NT�
TITLE_FILErV)�encodingrk)r&r1rWrrXr)rr rrrl�s

�zAButtonClickTest.test_view_file_bind_with_button.<locals>._commandrmrnTrrrArBz3.0z3.end)r	rror>rrEr&r)r[rTrYrCrF�openrX�readline�strip)r!rlrprF�frr r�test_view_file_bind_with_button�s
z/ButtonClickTest.test_view_file_bind_with_buttonN)rrrr"rhrqrxrrrrrg�s
rg�__main__�)�	verbosity)!�__doc__Zidlelibrr1Ztest.supportrr]Zunittest�tkinterrrrrrZtkinter.ttkr	Zidlelib.idle_test.mock_idler
Zidlelib.idle_test.mock_tkrrrrSrZTestCaserr0r4rLrNrgr�mainrrrr�<module>s(,.)