Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/idlelib/idle_test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/idlelib/idle_test/__pycache__/test_textview.cpython-312.opt-1.pyc

�

&Μg�����dZddlmZddlmZed�ddlZddlZddlm	Z	m
Z
mZmZm
Z
ddlmZddlmZdd	lmZd
�Zd�ZGd�d
ej,�ZGd�dej0�ZGd�dej0�ZGd�dej0�ZGd�dej0�ZGd�dej0�ZGd�dej0�Zedk(rej@d��yy)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)�requires�guiN)�Tk�TclError�CHAR�NONE�WORD)�Button)�Func)�	Mbox_funcc�@�t�atj�y�N�r�root�withdraw���</usr/local/lib/python3.12/idlelib/idle_test/test_textview.py�setUpModulers��
�4�D��M�M�Orc�V�tj�tj�byr�r�update_idletasks�destroyrrr�tearDownModulers�������L�L�N�rc�6�eZdZe�Ze�Ze�Zy)�VWN)�__name__�
__module__�__qualname__r�	transient�grab_set�wait_windowrrrrr#s����I��v�H��&�Krrc�$�eZdZd�Zd�Zd�Zd�Zy)�ViewWindowTestc��tjj�tjj�tjj�yr)rr!�__init__r"r#��selfs r�setUpzViewWindowTest.setUp,s2��
������
������
�����!rc�<�ttdd�}|jtjj�|jtj
j�|jtjj�|j�y)N�Title�	test text)rr�
assertTruer!�calledr"r#�ok�r)�views  r�test_init_modalzViewWindowTest.test_init_modal1s[���$���-��������+�+�,�������*�*�+�������-�-�.����	rc�@�ttddd��}|jtjj�|jtj
j�|jtjj�|j�y�Nr,r-F��modal)rr�assertFalser!r/r"r#r0r1s  r�test_init_nonmodalz!ViewWindowTest.test_init_nonmodal8sc���$���E�:��������,�,�-�������+�+�,�������.�.�/����	rc���ttddd��}t�|_|j	�|j|jj�|`|j�yr5)rrrrr0r.r/r1s  r�test_okzViewWindowTest.test_ok?sH���$���E�:���v������	�������+�+�,��L����rN)rrr r*r3r9r;rrrr%r%*s��"�
��rr%c��eZdZd�Zy)�AutoHideScrollbarTestc��tjt�}|jt|j
�|jt|j�yr)�tv�AutoHideScrollbarr�assertRaisesr�pack�place)r)�scrolls  r�test_forbidden_geometryz-AutoHideScrollbarTest.test_forbidden_geometryJs:���%�%�d�+�����(�F�K�K�0����(�F�L�L�1rN)rrr rErrrr=r=Hs��2rr=c�B�eZdZed��Zed��Zefd�Zd�Zd�Z	y)�ScrollableTextFrameTestc�F�t�x|_}|j�yrr��clsrs  r�
setUpClassz"ScrollableTextFrameTest.setUpClassRs���$����4��
�
�rc�p�|jj�|jj�|`yrr�rJs r�
tearDownClassz%ScrollableTextFrameTest.tearDownClassWs'�����!�!�#��������Hrc�x��tj|jfd|i|����fd�}|j|��S)N�wrapc�F���j��j�yr)rr)�frames�r�
cleanup_framez9ScrollableTextFrameTest.make_frame.<locals>.cleanup_frame_s����"�"�$��M�M�Or)r?�ScrollableTextFramer�
addCleanup)r)rP�kwargsrSrRs    @r�
make_framez"ScrollableTextFrameTest.make_frame]s9����&�&�t�y�y�F�t�F�v�F��	�	
���
�&��rc��|j�}|jjdd�|j|jj	dd�d�y)N�1.0r-�1.end)rW�text�insert�assertEqual�get)r)rRs  r�
test_line1z"ScrollableTextFrameTest.test_line1esA�����!��
�
�
���%��-����������w�7��Erc���|jt��}|j|jj	d�t�|j|j�ttfD]u}|j|��5|j|��}|j|jj	d�|�|j|j�ddd��wy#1swY��xYw)N)rPrP)rWr	r]r[�cget�assertIsNotNone�xscrollrr
�subTest�assertIsNone)r)rRrPs   r�test_horiz_scrollbarz,ScrollableTextFrameTest.test_horiz_scrollbarjs������T��*�����������0�$�7����U�]�]�+��4�L�D����4��(����T��2��� � �������!8�$�?��!�!�%�-�-�0�)�(�!�(�(�s
�AC&�&C/	N)
rrr �classmethodrKrNr	rWr_rfrrrrGrGPs=����������
#��F�
1rrGc�2�eZdZed��Zed��Zd�Zy)�
ViewFrameTestc�|�t�x|_}|j�tj|d�|_y)Nr-)rrrr?�	ViewFramerRrIs  rrKzViewFrameTest.setUpClass~s+���$����4��
�
���L�L��{�3��	rc�t�|`|jj�|jj�|`yr)rRrrrrMs rrNzViewFrameTest.tearDownClass�s,���I����!�!�#��������Hrc�v�|jjj}|j|dd�d�y)NrYrZr-)rRr[r^r])r)r^s  rr_zViewFrameTest.test_line1�s,���j�j�o�o�!�!������U�G�,�k�:rN)rrr rgrKrNr_rrrriri|s-���4��4�
����;rric�J�eZdZed��Zed��Zd�Zd�Zd�Zd�Z	d�Z
y)	�ViewFunctionTestc�T�tj|_t�t_yr)r?�	showerror�
orig_errorr
rMs rrKzViewFunctionTest.setUpClass�s������� �{��rc�2�|jt_|`yr)rrr?rqrMs rrNzViewFunctionTest.tearDownClass�s���~�~����Nrc��tjtddd��}|j|tj�|j|j
tj�|j
j�yr5)r?�	view_textr�assertIsInstance�
ViewWindow�	viewframerkr0r1s  r�test_view_textzViewFunctionTest.test_view_text�sR���|�|�D�'�;�e�D�����d�B�M�M�2����d�n�n�b�l�l�;������rc��tjtdtdd��}|j	|tj
�|j	|jtj�|jjjj}|jd|dd��|j�y)Nr,�asciiFr6�TestrYrZ)
r?�	view_filer�__file__rvrwrxrk�	textframer[r^�assertInr0)r)r2r^s   r�test_view_filezViewFunctionTest.test_view_file�s}���|�|�D�'�8�W�E�J�����d�B�M�M�2����d�n�n�b�l�l�;��n�n�&�&�+�+�/�/���
�
�f�c�%��1�2����	rc��tjtdddd��}|j|�|j	tj
jd�y)Nr,zabc.xyzr{Fr6zFile Load Error)r?r}rrer]rq�titler1s  r�
test_bad_filezViewFunctionTest.test_bad_file�sA���|�|�D�'�9�g�U�K�����$��������+�+�->�?rc�@�tj}|j|j|j	t
�dd��}t
jtd|dd��}|j|�|jtjjd�y)Nz..zCREDITS.txtr,r{Fr6zUnicode Decode Error)
�os�path�abspath�join�dirnamer~r?r}rrer]rqr�)r)�p�fnr2s    r�test_bad_encodingz"ViewFunctionTest.test_bad_encoding�sn���G�G��
�Y�Y�q�v�v�a�i�i��1�4��G�
H���|�|�D�'�2�w�e�D�����$��������+�+�-C�Drc���tjtdddd��}|jjj
}|j
|jd�d�y)Nr,�testF�none)r7rPrP)r?rurrxrr[r]ra)r)r2�text_widgets   r�test_nowrapzViewFunctionTest.test_nowrap�sH���|�|�D�'�6��V�L���n�n�.�.�3�3������)�)�&�1�6�:rN)rrr rgrKrNryr�r�r�r�rrrroro�sC���#��#�������@�E�;rroc�$�eZdZd�Zd�Zd�Zd�Zy)�ButtonClickTestc� �d|_d|_y)NF)r2r/r(s rr*zButtonClickTest.setUp�s����	���rc�R�|jr|jj�yyr)r2rr(s r�tearDownzButtonClickTest.tearDown�s���9�9��I�I����rc����fd�}ttd|��}|j��j|j��j�jd��j�jj�d��j�jjjjjdd�d�y)	Nc�X��d�_tjtddd���_y)NT�
TITLE_TEXT�COMMAND)�_utest)r/r?rurr2r(s�r�_commandzAButtonClickTest.test_view_text_bind_with_button.<locals>._command�s ����D�K����T�<��4�P�D�Ir�BUTTON�r[�commandTr�rYrZr�)
rr�invokerUrr]r/r2r�rxrr[r^)r)r��buttons`  r�test_view_text_bind_with_buttonz/ButtonClickTest.test_view_text_bind_with_button�s����	Q���8�X�>���
�
��������'�������d�+���������*�L�9�������,�,�6�6�;�;�?�?��w�O�"�	$rc����fd�}ttd|��}|j��j|j��j�jd��j�jj�d��jjjjj}tt�5}�j|dd�|j�j!��|j��j|dd	�|j�j!��ddd�y#1swYyxYw)
Nc�b��d�_tjtdtdd���_y)NT�
TITLE_FILEr{)�encodingr�)r/r?r}rr~r2r(s�rr�zAButtonClickTest.test_view_file_bind_with_button.<locals>._command�s&����D�K����T�<��.5�d�D�D�Irr�r�Tr�rYrZz3.0z3.end)rrr�rUrr]r/r2r�rxrr[r^�openr~�readline�strip)r)r�r�r^�fs`    r�test_view_file_bind_with_buttonz/ButtonClickTest.test_view_file_bind_with_button�s����	D���8�X�>���
�
��������'�������d�+���������*�L�9��i�i�!�!�+�+�0�0�4�4��
�(�^�q����S���0�!�*�*�,�2D�2D�2F�G�
�J�J�L����S���0�!�*�*�,�2D�2D�2F�G��^�^�s
�
A;E�EN)rrr r*r�r�r�rrrr�r��s��� �$�Hrr��__main__�)�	verbosity)!�__doc__�idlelibrr?�test.supportrr��unittest�tkinterrrrr	r
�tkinter.ttkr�idlelib.idle_test.mock_idler�idlelib.idle_test.mock_tkr
rrrwr�TestCaser%r=rGriror�r�mainrrr�<module>r�s����#�!����	��2�2��,�/��

�������X�&�&��<2�H�-�-�2�)1�h�/�/�)1�X;�H�%�%�;�**;�x�(�(�*;�\&H�h�'�'�&H�R�z���H�M�M�A��r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists