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_browser.cpython-312.opt-2.pyc

�

&Μg� ��p�	ddlmZddlmZddlZddlmZddlmZddlm	Z	ddl
mZddlZ
ddlZddlmZdd	lmZGd
�dej&�ZeZd\ZZej1ed
dgedd��Zej5eddd�Zej9eddddg�Zej9eddd�Zej5eddd�ZejAededd��Z!ej5e!ddd �Z"ej5e"d!d"d"�Z#ej9e!d#dd�Z$ee!d$�Z%ejLe%d%�ejLejN�Gd&�d'ej&�Z(Gd(�d)ej&�Z)Gd*�d+ej&�Z*Gd,�d-ej&�Z+e,d.k(rejZd/�0�yy)1�)�browser)�requiresN)�mock)�Func)�
py_extensions)�deque)�Tk)�TreeNodec�J�eZdZed��Zed��Zd�Zd�Zd�Zd�Z	d�Z
y)	�ModuleBrowserTestc���td�t�|_|jj�t	j
|jtd��|_y)N�guiT)�_utest)rr	�root�withdrawr�
ModuleBrowser�__file__�mb��clss �;/usr/local/lib/python3.12/idlelib/idle_test/test_browser.py�
setUpClasszModuleBrowserTest.setUpClasss<������4����������&�&�s�x�x��$�G���c��|jj�|jj�|jj	�|`|`y�N)r�closer�update_idletasks�destroyrs r�
tearDownClasszModuleBrowserTest.tearDownClasss8�����������!�!�#��������H�c�frc��|j}|j}||jt�|tj
i�|j
|jt�|jtj�yr)r�assertEqual�pathr�pyclbr�_modules�assertIsInstance�noder
�assertIsNotNoner�	file_open)�selfr�eqs   r�	test_initzModuleBrowserTest.test_init"sZ��
�W�W��
�
�
��
�2�7�7�H��
�6�?�?�B�����b�g�g�x�0����W�.�.�/rc��|j}|jtjj	t
�|jj��|j|jj�d�y)NzModule Browser)
r�assertIn�osr"�basenamer�top�titler!�iconname�r)rs  r�
test_settitlezModuleBrowserTest.test_settitle*sN��
�W�W���
�
�b�g�g�&�&�x�0�"�&�&�,�,�.�A���������*�,<�=rc�|�|j}|j�}|j|tj�yr)r�rootnoder%r�ModuleBrowserTreeItem)r)r�rns   r�
test_rootnodezModuleBrowserTest.test_rootnode/s,��
�W�W��
�[�[�]�����b�'�"?�"?�@rc��|j}t�|j_t�|j_|j�|j
|jjj�|j
|jjj�|j`|j`yr)rrr0rr&r�
assertTrue�calledr3s  r�
test_closezModuleBrowserTest.test_close4ss��
�W�W���������&�����
���
���������-�-�.���������.�.�/��F�F�N�B�G�G�Orc���d}tD]\}|j|��5|�|��}tj|�}|tjv}|j||�ddd��^y#1swY�ixYw)Nz
/path/to/file)�ext)r�subTestr�is_browseable_extension�browseable_extension_blocklistr!)r)r"r?�filename�actual�expecteds      r�test_is_browseable_extensionz.ModuleBrowserTest.test_is_browseable_extension=sk���� �C����#��&�"�V�C�5�>�� �8�8��B���g�&L�&L�L��� � ���2�	'�&�!�&�&�s�AA)�)A2	N)�__name__�
__module__�__qualname__�classmethodrrr+r4r9r=rF�rrrrsD���H��H�����0�>�
A�
,�3rr)�testztest.py�C0�base��	)�
end_lineno�F1���C1���C2��F3�f0���f1���f2�
�c1)rMr[rLc��eZdZd�Zd�Zy)�TransformChildrenTestc�|�|j}tj}t|td��}||t
tg�||djd�||djd�t|td��}||djd�t|td��}||g�y)NrLr�C0(base)rOr[zdifferent name)r!r�transform_children�list�mock_pyclbr_treerMr[�name�r)r*�	transform�tcls    r�test_transform_module_childrenz4TransformChildrenTest.test_transform_module_children_s���
�
�
���.�.�	��9�-�v�6�7��
�3��R���
�3�q�6�;�;�
�#�
�3�q�6�;�;����9�-�v�6�7��
�3�q�6�;�;�
�#��9�-�/?�@�A��
�3��rc���|j}tj}t|tj
��}||ttg�||djd�||djd�t|tj
��}||djd�|t|tj
��ttg�y)NrrRrO�C1())r!rrhrirM�childrenrRrUrkr[r^rcrls    r�test_transform_node_childrenz2TransformChildrenTest.test_transform_node_childrenns���
�
�
���.�.�	��9�R�[�[�)�*��
�3��R���
�3�q�6�;�;���
�3�q�6�;�;����9�R�[�[�)�*��
�3�q�6�;�;���
�4�	�"�+�+�&�'�"�b��2rN)rGrHrIrorsrKrrrere]s��
�3rrec�p�eZdZed��Zd�Zd�Zd�Zd�Zd�Z	d�Z
ejd�d	��Z
y
)�ModuleBrowserTreeItemTestc�@�tjt�|_yr)rr7�fname�mbtrs rrz$ModuleBrowserTreeItemTest.setUpClass~s���/�/��6��rc�X�|j|jjt�yr)r!rx�filerw�r)s rr+z#ModuleBrowserTreeItemTest.test_init�s�����������.rc�`�|j|jj�t�yr)r!rx�GetTextrwr{s r�test_gettextz&ModuleBrowserTreeItemTest.test_gettext�s��������)�)�+�U�3rc�X�|j|jj�d�y)N�python)r!rx�GetIconNamer{s r�test_geticonnamez*ModuleBrowserTreeItemTest.test_geticonname�s��������-�-�/��:rc�V�|j|jj��yr)r;rx�IsExpandabler{s r�test_isexpandablez+ModuleBrowserTreeItemTest.test_isexpandable�s��������-�-�/�0rc���tjj}tj}t	t
��tj_t	ttg��t_	|j|jj�ttg�|tj_|t_y#|tj_|t_wxYw)N��result)rr#�
readmodule_exrhrrjr[rMr!rx�listchildren)r)�save_rex�save_tcs   r�test_listchildrenz+ModuleBrowserTreeItemTest.test_listchildren�s����>�>�/�/���,�,��'+�3C�'D����$�%)�"�b��%:��"�	1����T�X�X�2�2�4�r�2�h�?�+3�G�N�N�(�)0�G�&��,4�G�N�N�(�)0�G�&�s�.4C�"C%c�l�|j}tttg��|_|j�\}}|`|j
|tj�|j
|tj�|j|jd�|j|jd�y)Nr�r[rg)rxrr[rMr��
GetSubListr%r�ChildBrowserTreeItemr!rk)r)rx�sub0�sub1s    r�test_getsublistz)ModuleBrowserTreeItemTest.test_getsublist�s����h�h����B�x�0����^�^�%�
��d������d�G�$@�$@�A����d�G�$@�$@�A�������D�)�������J�/r�idlelib.browser.file_openc�V�|j}tjdd��5|j�|j	�ddd�tjdd��5|j�|jt�ddd�y#1swY�OxYw#1swYyxYw)Nzos.path.existsF)�return_valueT)rxr�patch�
OnDoubleClick�assert_not_called�assert_called_once_withrw)r)�fopenrxs   r�test_ondoubleclickz,ModuleBrowserTreeItemTest.test_ondoubleclick�s|���h�h��
�Z�Z�(�u�
=������#�#�%�>��Z�Z�(�t�
<������)�)�%�0�=�
<�	>�
=��=�
<�s�!B�$&B�B�B(N)rGrHrIrJrr+r~r�r�r�r�rr�r�rKrrruru|sR���7��7�/�4�;�1�	1�0��T�Z�Z�+�,�	1�-�	1rruc�z�eZdZed��Zed��Zd�Zd�Zd�Zd�Z	d�Z
ejd�d	��Z
y
)�ChildBrowserTreeItemTestc��tj}|t�|_|t�|_|t�|_yr)rr�r^�cbt_f1rU�cbt_C1rR�cbt_F1)r�CBTs  rrz#ChildBrowserTreeItemTest.setUpClass�s.���*�*����W��
���W��
���W��
rc��|`|`|`yr)r�r�r�rs rrz&ChildBrowserTreeItemTest.tearDownClass�s���J��
�C�Jrc�$�|j}||jjd�|j|jj�||j
jd�|j
|j
j�y)Nrqr^)r!r�rk�assertFalse�
isfunctionr�r;)r)r*s  rr+z"ChildBrowserTreeItemTest.test_init�sc��
�
�
��
�4�;�;���V�$�������/�/�0�
�4�;�;���T�"�������.�.�/rc��|j|jj�d�|j|jj�d�y)Nz
class C1()zdef f1(...))r!r�r}r�r{s rr~z%ChildBrowserTreeItemTest.test_gettext�s<��������,�,�.��=�������,�,�.�
�>rc��|j|jj�d�|j|jj�d�y)N�folderr�)r!r�r�r�r{s rr�z)ChildBrowserTreeItemTest.test_geticonname�s<��������0�0�2�H�=�������0�0�2�H�=rc��|j|jj��|j|jj��|j	|j
j��yr)r;r�r�r�r�r�r{s rr�z*ChildBrowserTreeItemTest.test_isexpandable�sO��������0�0�2�3�������0�0�2�3�������1�1�3�4rc�,�|j}tj}|jj	�}|j|d|�|t
|�d�||djd�||jj	�g�y)NrrOra)	r!rr�r�r�r%�lenrkr�)r)r*r��	f1sublists    rr�z(ChildBrowserTreeItemTest.test_getsublist�sw��
�
�
���*�*���K�K�*�*�,�	����i��l�C�0�
�3�y�>�1��
�9�Q�<���d�#�
�4�;�;�!�!�#�R�(rr�c� �tj�x}|j_|jj�|j
�|j
�|j|jjj�yr)
r�Mockr��gotoliner�r��
assert_called�assert_called_with�obj�lineno)r)r��gotos   rr�z+ChildBrowserTreeItemTest.test_ondoubleclick�s_��-1�Y�Y�[�8��u�!�!�*����!�!�#�
���������������� 6� 6�7rN)rGrHrIrJrrr+r~r�r�r�rr�r�rKrrr�r��sa�������/��/�0�?�>�5�
	)��T�Z�Z�+�,�8�-�8rr�c��eZdZ	d�Zy)�NestedChildrenTestc�2�t�}g}gd�}tj}|j|t�|t
�f�|r�|j
�}|j�}|j|�|j|j|j��|j|j�d�|j|j�|gk7�|j|j�|r��|j||�y)N)	r[rgr^rcrRrqrarXrZ)r�r�)rrr��extendr[rM�popleftr�r-rkr}r��assertIsr��appendr!)r)�queue�actual_names�expected_namesr��cb�sublists       r�test_nestedzNestedChildrenTest.test_nested�s�������� ���*�*��
���c�"�g�s�2�w�'�(������B��m�m�o�G��L�L��!��M�M�"�'�'�2�:�:�<�0��M�M�"�.�.�*�,@�A��M�M�"�/�/�+�W��]�;�������(��	
����~�6rN)rGrHrIr�rKrrr�r��s
��L�7rr��__main__�)�	verbosity).�idlelibr�test.supportr�unittestr�idlelib.idle_test.mock_idler�idlelib.utilr�collectionsr�os.pathr.r#�tkinterr	�idlelib.treer
�TestCaserr�modulerw�ClassrM�_nest_functionrR�_nest_classrUrXrZ�Functionr[r^rarcrjrhrrrerur�r�rG�mainrKrr�<module>r�s�����!���,�&���
��!�23��)�)�23�l��!�
����X�X�f�d�V�H�e�Q�1�X�=�����r�4��A�&���^�^�B��a��R�D�)���^�^�B��a��#�����r�4��A�&���[�[���u�b�R�[�8�����r�4��R�(�����r�4��R�(���^�^�B��b�"�%���B�'������+�V�4�����2�;�;�'�3�H�-�-�3�>11�� 1� 1�11�h28�x�0�0�28�l7��*�*�7�4�z���H�M�M�A��r

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