Sindbad~EG File Manager
�
&Μg�h��f�dZddlmZddlZddlmZddlZddlZddlm Z m
Z
ddlmZddl
ZddlmZddlmZdd lmZdd
lmZddlZddlmZmZmZddlmZddlZdd
lmZm Z Gd�d�Z!Gd�dejD�Z#Gd�dejD�Z$e%dk(rejLd��yy)zTest sidebar, coverage 85%�)�dedentN)�chain)�requires� swap_attr)�support)�run_in_tk_mainloop)� Delegator)�
fixwordbreaks)�
Percolator)�
fix_x11_paste�PyShell�PyShellFileList)�fix_scaling)�get_end_linenumber�
get_linenoc��eZdZd�Zd�Zd�Zy)�
Dummy_editwinc���||_|jj|_t|�|_t�|_|jj|j�y�N)�text�master�
text_framer�perr �undo�insertfilter)�selfrs �;/usr/local/lib/python3.12/idlelib/idle_test/test_sidebar.py�__init__zDummy_editwin.__init__sE���� ��)�)�*�*����d�#����K�� ������d�i�i�(�c��yr�)r�name�values r�setvarzDummy_editwin.setvars��rc�\�tt|jj|���Sr)�int�floatr�index)rr(s r� getlinenozDummy_editwin.getlineno"s���5�������/�0�1�1rN)�__name__�
__module__�__qualname__rr$r)r!rrrrs��)�
�2rrc�(�eZdZed��Zed��Zd�Zd�Zd�Zd�Z d�Z
d�Zd �Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zej*d�d��Zd�Zej*d�d��Zej*d�d��Zd�Zd�Zd�Zy)�LineNumbersTestc��td�tj�|_|jj �tj
|j�|_|jjtjtjd��|jjdd��|jjdd��tj|jddtj��|_|jjddtj � �t#|j�|_tj&|j�|j$_y)
N�guiT)�side�fill�expand�)�weight�P�)�width�height�wrap)�row�column�sticky)r�tk�Tk�root�withdraw�Framer�pack�LEFT�BOTH�rowconfigure�columnconfigure�Text�NONEr�grid�NSEWr�editwin� Scrollbar�vbar��clss r�
setUpClasszLineNumbersTest.setUpClass(s�������5�5�7������������#�(�(�+�����������r�w�w�t��D����#�#�A�a�#�0����&�&�q��&�3��7�7�3�>�>��B�R�W�W�M������
�
�!�A�b�g�g�
�6�#�C�H�H�-����<�<����7����rc���|jjj�|jj �|jj�|`|`|`|`yr)rLr�closer@�update_idletasks�destroyrrrOs r�
tearDownClasszLineNumbersTest.tearDownClass9sG�������������!�!�#��������H�c�n�c�k�3�8rc����tjj�j��_ddd��_tjjj���fd�}tjjjtjjd|�}|j��j|j�d�_�fd�}tjjjtjjd|�}|j��j|j�y) N�#abcdef�#123456��
background�
foregroundc�8��|dk(r�jS�||�S)N�
linenumber)�
highlight_cfg)�theme�element�orig_idleConf_GetHighlightrs ��r�mock_idleconf_GetHighlightz9LineNumbersTest.setUp.<locals>.mock_idleconf_GetHighlightFs$����,�&��)�)�)�-�e�W�=�=r�GetHighlight�TkFixedFontc����jSr)�
font_override)r@�
configType�sectionrs �r�mock_idleconf_GetFontz4LineNumbersTest.setUp.<locals>.mock_idleconf_GetFontPs����%�%�%r�GetFont)�idlelib�sidebar�LineNumbersrLr^r_�idleConfrd�unittest�mock�patch�object�start�
addCleanup�stoprg)rrc�GetHighlight_patcherrj�GetFont_patcherrbs` @r�setUpzLineNumbersTest.setUp@s����!�/�/�5�5�d�l�l�C���,5�,5�7���%,�_�_�%=�%=�%J�%J�"� >� (�}�}�2�2�9�9��O�O�$�$�n�6P� R���"�"�$����,�1�1�2�*��� &�"�-�-�-�-�4�4��O�O�$�$�i�1F�H����������,�,�-rc�<�|jjdd�y�N�1.0�end)r�delete�rs r�tearDownzLineNumbersTest.tearDownWs��� � �����&rc�f�ttt|jj d���S)N�sel)�tuple�map�strr�
tag_rangesrs r�
get_selectionzLineNumbersTest.get_selectionZs#���S��d�i�i�2�2�5�9�:�;�;rc�z�|jjj|�d��}|ddz}|ddz}||fS)Nz.end -1cr�r4)r^�sidebar_text�bbox)r�liner��x�ys r�get_line_screen_positionz(LineNumbersTest.get_line_screen_position]sF�����+�+�0�0�D�6��1B�C����G�a�K����G�a�K���!�t�rc��|jjj�d}|j|dtj
�y)N�state���)r^r��config�assertEqualr>�DISABLED)rr�s r�assert_state_disabledz%LineNumbersTest.assert_state_disabledcs7�����,�,�3�3�5�g�>������r��B�K�K�0rc�j�|jjjdtj�S)Nr|)r^r��getr>�ENDrs r�get_sidebar_text_contentsz)LineNumbersTest.get_sidebar_text_contentsgs#�����+�+�/�/��r�v�v�>�>rc��djtttt d|dz��dg��}|j|j
�|�y)N�
r4�)�joinrr�r��ranger�r�)r�n_lines�expecteds r�assert_sidebar_n_linesz&LineNumbersTest.assert_sidebar_n_linesjsD���9�9�U�3�s�E�!�W�q�[�,A�#B�R�D�I�J������7�7�9�8�Drc�Z�|j|jjdd�|�Sr{)r�rr�)rr�s r�assert_text_equalsz"LineNumbersTest.assert_text_equalsns$������ � �
�
�e�U� ;�X�F�Frc�&�|jd�y�Nr4)r�rs r�test_init_emptyzLineNumbersTest.test_init_emptyqs���#�#�A�&rc��|jjdd�|jd�|jd�y)N�insertzfoo bar
foo bar
foo bar
zfoo bar
foo bar
foo bar
�)rr�r�r�rs r�test_init_not_emptyz#LineNumbersTest.test_init_not_emptyts3��� � ����=�1���� 4�5��#�#�A�&rc���|j|jjd�|jj�|j|jjd�|jj �|j|jjd�|jj �|j|jjd�|jj�|j|jjd�|jj�|j|jjd�y)NFT)r�r^�is_shown�show_sidebar�hide_sidebarrs r�test_toggle_linenumberingz)LineNumbersTest.test_toggle_linenumberingys���������1�1�5�9����$�$�&�������1�1�4�8����$�$�&�������1�1�5�9����$�$�&�������1�1�5�9����$�$�&�������1�1�4�8����$�$�&�������1�1�4�8rc�t�|jjdd�|jd�|jd�|j �|jjdd�|jd�|jd�|j �|jjdd�|jd �|jd
�|j �|jjdd�|jd�|jd
�|j �y)Nr��foobar�foobar
r4z
foozfoobar
foo
r�zhello
hello
zfoobar
foohello
hello
r�z
worldzfoobar
foohello
hello
world
�)rr�r�r�r�rs r�test_insertzLineNumbersTest.test_insert�s���� � ����8�,����
�+��#�#�A�&��"�"�$�� � ����7�+�����0��#�#�A�&��"�"�$�� � ����;�/���� =�>��#�#�A�&��"�"�$�� � ����9�-���� D�E��#�#�A�&��"�"�$rc�j�|jjdd�|jd�|jjdd�|jd�|j d�|j�|jjdd�|jd �|j d
�|j�|jjdd�|jd
�|j d
�|j�|jjdd�|jd�|j d�|j�|jjdd�|jd�|j d�|j�y)Nr�r�r�z1.1z1.3zfbar
r4zfoo
foo
z
fbarfoo
foo
��2.0z2.endz
fbarfoo
r}zfba
r|r�)rr�r�r~r�r�rs r�test_deletezLineNumbersTest.test_delete�sU��� � ����8�,����
�+�� � �����&�����)��#�#�A�&��"�"�$�� � ����9�-���� 2�3��#�#�A�&��"�"�$�
� � �����(�����0��#�#�A�&��"�"�$�� � �����&�����(��#�#�A�&��"�"�$�
� � �����&�����%��#�#�A�&��"�"�$rc�����fd�}�jd��j|�d��jjdd��jd��j|�d��jjdd��jd��j|�d��jjdd��jd��j|�d ��jjdd��jd
��j|�d ��jj dd��jd��j|�d ��jj dd��jd��j|�d��jjdd
��jd��j|�d ��jjdd��jd��j|�d��jjdd��jd��j|�d��jj dd��jd��j|�d��jj dd��jd��j|�d ��jj dd��jd��j|�d ��jj dd��jd��j|�d��jj dd��jd��j|�d�y)zY
Test that linenumber text widget is always at the minimum
width
c�X���jjj�ddS)Nr8r�)r^r�r�rs�r� get_widthz:LineNumbersTest.test_sidebar_text_width.<locals>.get_width�s&����?�?�/�/�6�6�8��A�"�E�Err4r��fooz foo
foo
foo
foo
foo
foo
foo
foo
� zfoo
�
r��zinsert -1l linestartzinsert linestartahfoo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
�c�dr��ez50.0 -1czend -1c�1z5.0 -1cr�r|N)r�r�rr�r~)rr�s` r�test_sidebar_text_widthz'LineNumbersTest.test_sidebar_text_width�s
���
F�
�#�#�A�&������a�(�� � ����5�)��#�#�A�&������a�(�� � ����9�-��#�#�A�&������a�(�� � ����7�+��#�#�B�'������a�(�� � ����7�+��#�#�B�'������a�(�� � ���/�1C�D��#�#�B�'������a�(�� � ���/�1C�D��#�#�A�&������a�(�� � ����:�.��#�#�B�'������a�(�� � ����7�+��#�#�C�(������a�(�� � ����7�+��#�#�C�(������a�(�� � ���/�1C�D��#�#�C�(������a�(�� � ���/�1C�D��#�#�B�'������a�(�� � ����Y�/��#�#�B�'������a�(�� � ����I�.��#�#�A�&������a�(�
� � ���� �*��#�#�A�&������a�(rz
test disabledc���|jj�|jjdd�|jj�|j
d�\}}|jjjd||��|jjj�|jj�|j|j�d�y)Nr|zone
two
three
four
r��
<Button-1>�r�r�)r�z3.0)r^r�rr�r@�updater�r��event_generater�r�)rr�r�s r�test_click_selectionz$LineNumbersTest.test_click_selections������$�$�&�� � ���� 9�:�� � �����,�,�Q�/���1����$�$�3�3�L�A��3�K����$�$�+�+�-�� � ��������+�+�-�~�>rc�j�|j|�\}}|j|�\}}|jjjd||��|jj�d�}t
tt|||d���tt|||d����D]G\}} |jjjd|| ��|jj��I|jjjd||��|jj�y)Nr�r�c3�bK�|dz
}t|�D]}||z
|z|z||z|zz���y�w)z;linearly interpolate from a to b (inclusive) in equal stepsr4N)r�)�a�b�steps� last_step�is r�lerpz+LineNumbersTest.simulate_drag.<locals>.lerps?������ �I��5�\��!�A�
��2�a�7�1�y�=�A�:M�M�M�"�s�-/r�)r�z<B1-Motion>z<ButtonRelease-1>) r�r^r�r�r@r��zipr�r&)
r�
start_line�end_line�start_x�start_y�end_x�end_yr�r�r�s
r�
simulate_dragzLineNumbersTest.simulate_drags
���8�8��D�����4�4�X�>���u����$�$�3�3�L�6=�� 4� J�� � ���� N���C��g�u�B�7�8��C��g�u�B�7�8�
�D�A�q�
�O�O�(�(�7�7�
��a�7�P��I�I����
�
���$�$�3�3�4G�6;�u� 4� F�� � ���rc��|jj�|jjdd�|jj�|j
dd�|j|j�d�y)Nr|�one
two
three
four
five
r�r��r�z5.0� r^r�rr�r@r�r�r�r�rs r�test_drag_selection_downz(LineNumbersTest.test_drag_selection_down+�b�����$�$�&�� � ���� ?�@�� � ����
���1�a� �����+�+�-�~�>rc��|jj�|jjdd�|jj�|j
dd�|j|j�d�y)Nr|r�r�r�r�r�rs r�test_drag_selection_upz&LineNumbersTest.test_drag_selection_up5r�rc��|jj�|jjdd�|jj�|jj
dd�|jj�|j|jjd�d�|j|jjjd�d�|jjjdddd� �|jj�|j|jjd�d�|j|jjjd�d�y)
Nr|a�line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
line
r��unit�@0,0z11.0�<MouseWheel>r�r�r��delta)r^r�rr�r@r��yview_scrollr�r(r�r��assertNotEqualrs r�test_scrollzLineNumbersTest.test_scroll?s�����$�$�&�� � �����/�� � ����
� � ���r�6�*�� � �������������0�&�9�������5�5�;�;�F�C�V�L�
���$�$�3�3�N�67�1�:<� 4� >�
� � �������D�I�I�O�O�F�3�V�<����D�O�O�8�8�>�>�v�F��Orc�z�|j}|jd}d}|j||�|j�||_|j�|j
�|j|jd|�||_|j�|j|jd|�y)N�font�
TkTextFont)r^r�r�r�rg�update_fontr�r�)r�ln� orig_font� test_fonts rr�zLineNumbersTest.test_fontTs���
�_�_���O�O�F�+� � � ����I�y�1� ����&���
���� �����������0�)�<�'���
�����������0�)�<rc�L����j�t�j�}ddd�}��fd�}�j�|�_�j ��j�||��j �||�|�_�j �||�y)Nz#222222z#ffff00rZc����j�jd|d��j�jd|d�y)Nr[r\)r�r�)�colorsr�rs ��r�assert_colors_are_equalzFLineNumbersTest.test_highlight_colors.<locals>.assert_colors_are_equalqs?������R�_�_�\�:�F�<�<P�Q����R�_�_�\�:�F�<�<P�Qr)r^�dictr_r��
update_colorsr�)r�orig_colors�test_colorsr�r�s` @r�test_highlight_colorsz%LineNumbersTest.test_highlight_colorsks����
�_�_���4�-�-�.��%.�i�H�� R�
����(���
���� ������,� ������,�)���
������,rN)r*r+r,�classmethodrQrVryr�r�r�r�r�r�r�r�r�r�r�r�r�rp�skipr�r�r�r�r�r�r�r!rrr.r.&s����8��8� �<��<�.�.'�<��1�?�E�G�'�'�
9�%�*%�<B)�V�X�]�]�?�#�?�$�?��2�X�]�]�?�#�?�$�?��X�]�]�?�#�?�$�?�P�*=�.-rr.c���eZdZUdZej
ed<dZeed<e d��Z
e d��Ze d��Ze d��Z
d�Zd �Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Ze�d��Ze�d��Ze�d��Ze�d��Ze�d��Ze�d��Ze�d��Zd�Zd�Z e�d��Z!e�d��Z"e�d��Z#y)�ShellSidebarTestNr@�shellc��td�tj�x|_}|j �t|�t
|�t|�t|�x|_ }|j�|j�y)Nr0)rr>r?r@rArr
rr�flistrT�
init_shell)rPr@rs rrQzShellSidebarTest.setUpClass�sc������%�%�'�!���4��
�
���D���d���d��+�D�1�1�� �E��������rc��|j�2d|j_|jj�d|_d|_|jj�|jj
�d|_y)NF)r� executingrSrr@rTrUrOs rrVzShellSidebarTest.tearDownClass�s[���9�9� �"'�C�I�I���I�I�O�O���C�I��� ����!�!�#���������rc���|jj�|_d|j_|jj�t
|jjd�dz
|_y)Nr��end-1cr4) r�
open_shellr�pollintervalr@r�rr�n_preface_linesrOs rrzShellSidebarTest.init_shell�sL���I�I�(�(�*�� �!#�� � ��������(�������B�Q�F��rc��|jjjj|jdz�d�d�|jj
j
�|jj�y)Nr4�.0r) rr�bottomr~r�
shell_sidebar�update_sidebarr@r�rOs r�reset_shellzShellSidebarTest.reset_shell�sW��� � �
�
���#�#�s�':�':�1�'<�&=�R�$@�(�K�� � ���.�.�0������rc���d|_tj|jjk7r4tj|_|jjt_|j �yr)�
_saved_stdout�sys�stdoutrrrs rryzShellSidebarTest.setUp�sK��
"����:�:����*�*�*�!$���D�����*�*�C�J����rc�H�|j�|jt_yyr)rrrrs rr�zShellSidebarTest.tearDown�s �����)��+�+�C�J�*rc�j�|jjj}t|j t
j��}|D�cic]'}|j|�d|j|d���)}}|j�}|D�cgc]}|j|d���c}Scc}wcc}w)Nr4r)rr�canvas�list�findr>�ALLr��itemcget�get_shell_line_y_coordsr�)rr�textsr�texts_by_y_coords�
line_y_coordsr�s r�get_sidebar_linesz"ShellSidebarTest.get_sidebar_lines�s������)�)�0�0���V�[�[����(�)���
���
�K�K���a� �&�/�/�$��"?�?�� �
��4�4�6�
�8E�F�
�1�!�%�%�a��.�
�F�F��
��
Gs�
,B+�B0c��|jjj�|j|j �t|�d|�yr)rrrr�r!�len)r�expected_liness r�assert_sidebar_lines_end_withz.ShellSidebarTest.assert_sidebar_lines_end_with�sE���
�
� � �/�/�1�����"�"�$�c�.�&9�%9�%:�;��
rc�N�|jj}g}|jd�}|jdd�ddk7r|j|�d��}|j |�x}�<|j|d�|j|�d��}|j |�x}��<|S)Nr��.r4�0z +1line linestartz +1line)rrr(�split� dlineinfo�append)rr�y_coordsr(�lineinfos rrz(ShellSidebarTest.get_shell_line_y_coords�s����z�z�������
�
�6�"���;�;�s�A��q�!�S�(��J�J�%��(9�:�;�E��>�>�%�0�0�x�=��O�O�H�Q�K�(��J�J�%���0�1�E� �>�>�%�0�0�x�=��rc���|jjj�t�j t
j��}|j�fd���|D�cgc]}�j|�d��c}Scc}w)Nc�,���j|�dSr�)r�)rrs �r�<lambda>z<ShellSidebarTest.get_sidebar_line_y_coords.<locals>.<lambda>�s���F�K�K��$5�a�$8r)�keyr4) rrrrrr>r�sortr�)rrrrs @r�get_sidebar_line_y_coordsz*ShellSidebarTest.get_sidebar_line_y_coords�sd������)�)�0�0���V�[�[����(�)��
�
�
�8�
�9�16�7������D�!�!�$��7�7��7s�#Bc��|jt|j��t|j���yr)�assertLessEqual�setr3rrs r�assert_sidebar_lines_syncedz,ShellSidebarTest.assert_sidebar_lines_synced�s2�������.�.�0�1���,�,�.�/�
rc���|j}|j}t|jd��D].\}}|dkDr|j d�|jd|d��0y)Nr�r�<<newline-and-indent>>r��stdin)rr� enumerater)r�r�)r�inputrr�
line_indexr�s r�do_inputzShellSidebarTest.do_input�sW���
�
���z�z�� )�%�+�+�d�*;� <��J���A�~��#�#�$<�=��K�K��$��0�!=rc��|j�}|j|dgt|�dz
zdgz�|j�y)Nr4�>>>)r!r�r#r7)r�
sidebar_liness r�test_initial_statez#ShellSidebarTest.test_initial_state�sJ���.�.�0�
�����
�F�c�-�(�1�,�-���7�
�
�(�(�*rc#�\K�|jd�d��|jddg�y�w)Nr�r@�r>r%rs r�test_single_empty_inputz(ShellSidebarTest.test_single_empty_input�s'�����
�
�d��
��*�*�E�5�>�:���*,c#�\K�|jd�d��|jgd��y�w)Nz1
�r@Nr@rDrs r�test_single_line_statementz+ShellSidebarTest.test_single_line_statements$�����
�
�e��
��*�*�+?�@�rFc#�nK�|jtd��d��|jgd��y�w)N�7 if True:
print(1)
�r@�...rMrMNr@)r>rr%rs r�test_multi_line_statementz*ShellSidebarTest.test_multi_line_statements8����
�
�
�f��� �
��*�*�,
� �s�35c#�|K�|jd�d��|jgd��|j�y�w)Nz�11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
rH)r>r%r7rs r�test_single_long_line_wrapsz,ShellSidebarTest.test_single_long_line_wrapss1�����
�
�&�'�
��*�*�+?�@��(�(�*�s�:<c#�K�|j}|j}|jd�d��|jgd��|j dd�|jd�d��|jgd��|j
�|jjdj�d��|jgd��|j
�y�w)Nzprint("a\nb\nc")
)r@NNNr@r�zinsert -1line linestartz<<squeeze-current-text>>rHr)
rrr>r%�mark_setr�r7�squeezer�expandingbuttonsr3)rrrs r�test_squeeze_multi_line_outputz/ShellSidebarTest.test_squeeze_multi_line_output$s������
�
���z�z���
�
�,�-�
��*�*�+K�L��
�
�h�"9�;����6�7�
��*�*�+?�@��(�(�*�
���'�'��*�1�1�3�
��*�*�+K�L��(�(�*�s�CCc#�<K�|jj}|j�}|jt d��d��|jgd��|j�}|j
||�|jd�d��|jgd��|jd�|jd�d��|jgd��|jd|jd��|jd �d��|jd
�d��|jdg�|jd�d��|jdd
g�|jd �|jd �d��|jgd��y�w)Nz6 if True:
print(1)
)r@rMrMz<<interrupt-execution>>)r@rMrMNr@z<<history-previous>>)r@rMNr@r�z
insert -2lr9z<<undo>>r@z<<redo>>rMrL)
rrr!r>rr%r�r�rRr()rr�initial_sidebar_lines�with_block_sidebar_liness r�test_interrupt_recall_undo_redoz0ShellSidebarTest.test_interrupt_recall_undo_redo8se�����z�z���� $� 6� 6� 8���
�
�f��� � ��*�*�+@�A�#'�#9�#9�#;� ����4�6K�L�
���5�6�
��*�*�+M�N�
���2�3����5�6�
��*�*�+F�G�
�
�
�h��
�
�<� 8�9����4�5�
����J�'�
��*�*�E�7�3����J�'�
��*�*�E�5�>�:����4�5����4�5�
��*�*�5�
�s�FFc#�6K�tjd�5t|jdd�5|j dddzzdz�d��|j|j
�dg�ddd�ddd�y#1swY�xYw#1swYyxYw�w)Nig+rSzx = �1i'r�r@)r�adjust_int_max_str_digitsrrr>r�r!rs r�test_very_long_wrapped_linez,ShellSidebarTest.test_very_long_wrapped_linefsx����
�
.�
.�v�
6��$�*�*�j�$�7��M�M�&�3�v�:�-��4�5�����T�3�3�5��w�?�8�7�
6�7�7��7�
6�s4�B�B
�AB�0B
�8 B�B
�B
�
B�Bc�������jj�d��fd�}tjjjtjjd|���j���fd�}�j|���fd�}�j|����j��j|���y)Nr�c����Srr!)r@rhrir�s �rrjz9ShellSidebarTest.test_font.<locals>.mock_idleconf_GetFontss ����rrkc�F���j��j�yr)rvr�)rxrms��r�cleanupz+ShellSidebarTest.test_font.<locals>.cleanupxs���� � �"����!rc����j}t|jtj��}|D�chc]}|j|d���}}�j
t|�d�tt|��Scc}w)Nr�r4)
rrrr>rrr�r#�next�iter)rrr�fontsrrms ��r�get_sidebar_fontz4ShellSidebarTest.test_font.<locals>.get_sidebar_font}sk����^�^�F�����R�V�V�,�-�E�?D�E�u�t�V�_�_�T�6�2�u�E�E����S��Z��+���U��$�$��Fs�B)rrrprqrrrsrlrmrortrur�r�r�)rrjrarfrxrmr�s` @@@rr�zShellSidebarTest.test_fontns�����*�*�*�*�� � � �"�-�-�-�-�4�4��O�O�$�$�i�1F�H������ "�
���� � %�
���,�.� �:��������)�+�Y�7rc���������jj�ddd��tjjj
���fd�}tjjjtjjd|���j���fd�}�j|���fd�}�j|����j��j|���y)NrXrYrZc�"��|dvr�S�||�S)N)r^�consoler!)r`rarbr�s ��rrczJShellSidebarTest.test_highlight_colors.<locals>.mock_idleconf_GetHighlight�s����3�3�"�"�-�e�W�=�=rrdc�F���j��j�yr)rvr�)rwrms��rraz7ShellSidebarTest.test_highlight_colors.<locals>.cleanup�s��� �%�%�'��!�!�#rc�>���j}t|jtj��}|D�chc]}|j|d���}}�j
t|�d�tt|��}|jd�}||d�Scc}w)Nr2r4r[rZ)rrrr>rrr�r#rcrd�cget)rrr�fgs�fg�bgrrms ��r�get_sidebar_colorszBShellSidebarTest.test_highlight_colors.<locals>.get_sidebar_colors�s�����^�^�F�����R�V�V�,�-�E�=B�C�U�T�6�?�?�4��0�U�C�C����S��X�q�)��d�3�i��B����\�*�B�"$�B�7�7�� Ds�B)rrrlrmrordrprqrrrsrtrur�r�r�)rrcrarprwrbrmr�s` @@@@rr�z&ShellSidebarTest.test_highlight_colors�s�����*�*�*�*��%.�i�H��%,�_�_�%=�%=�%J�%J�"� >� (�}�}�2�2�9�9��O�O�$�$�n�&� (�� �"�"�$� $�
���� � 8�
���.�0�+�>��������+�-�{�;rc#�K�|jj}|jj}|jd�d��|j t|d�d�t
|�}|j|j|j|�d����|jjdk(rdnd}|jjdk(r|jjdd d �
�n|jjdd d |��d��|j|j|j|�d����|jjdk(r|jjd
d d �
�n |jjdd d |��d��|j|j|j|�d����y�w)Nzox = """
"""
r�r4r
�aqua�x�x11z
<Button-4>rr�r�r�z
<Button-5>)rrrr>�
assertGreaterrr�assertIsNotNoner*r(r�_windowingsystemr��assertIsNone)rrmr�last_linenor�s r�test_mousewheelz ShellSidebarTest.test_mousewheel�s|�����*�*�*�*���z�z����
�
�
�4�5�
����:�d�F�3�Q�7�(��.�����T�^�^�D�J�J�+��b�7I�,J�K�L��^�^�4�4��>��C���>�>�*�*�e�3��N�N�)�)�,�!�q�)�A��N�N�)�)�.�A��%�)�P�
����$�.�.����{�m�2�4F�)G�H�I��>�>�*�*�e�3��N�N�)�)�,�!�q�)�A��N�N�)�)�.�A��5�&�)�Q�
����T�^�^�D�J�J�+��b�7I�,J�K�L�s�GGc#�K�|jj}|jj}t|�}|j td��d��|j
d|�d�d�|jdd�}|j|jd��|jd|�|jd �|j|j�|j�}|j||�y�w)
NrKr�r
r� sel.first�sel.lastz if True:
z
1
z<<copy>>)rrrrr>r�tag_addr��
assertTrue�
startswith�assertInr�ru�clipboard_clear�
clipboard_getr�)rrmr�
first_line�
selected_text�copied_texts r� test_copyzShellSidebarTest.test_copy�s������*�*�*�*���z�z����'��-�
��
�
�f��� �
����U�z�l�"�-�x�8�����j�9�
����
�0�0��>�?��
�
�g�}�-����J�'�����,�,�-��(�(�*������m�4�s�C?Dc#��K�|jj}|jj}t|�}|j td��d��|j
d|�d�d�|jdd�}|j|jd��|jdd�}|jd �}|j�d
gdgt|�dz
zzdgz}d jd
�t||d��D��d z}|jd�|j!|j"�|j%�} |j'| |�y�w)Nz; if True:
print(1)
r�z.3rr|r}zTrue:
zsel.first linestartr�r@rMr�c3�:K�|]\}}|�|n|dz|z���y�w)N� r!)�.0�promptr�s r� <genexpr>z:ShellSidebarTest.test_copy_with_prompts.<locals>.<genexpr>�s2����/
�!1�����N�D����t�(;�;�!1�s�T)�strictz<<copy-with-prompts>>)rrrrr>rr~r�rr�r)�popr#r�r�r�rur�r�r�)
rrmrr�r��selected_lines_text�selected_lines�expected_prompts�selected_text_with_promptsr�s
r�test_copy_with_promptsz'ShellSidebarTest.test_copy_with_prompts�sT�����*�*�*�*���z�z����'��-�
��
�
�f��� �
����U�z�l�"�-�x�8�����j�9�
����
�0�0��;�<�"�h�h�'<�j�I��,�2�2�4�8�������G�u�g��^�!4�q�!8�9�9�T�F�B� �%)�Y�Y�/
� #�$4�$2�+/�!1�/
�&
�
�&�"�
���3�4�����,�,�-��(�(�*������&@�A�s�E!E#)$r*r+r,r@r>r?�__annotations__rr
r�rQrVrrryr�r!r%rr3r7r>rBrrErIrNrPrUrYr]r�r�rzr�r�r!rrrr�s����D�"�%�%���E�7������ �����G��G�����
�,�G�
� �8�
�1�+���;��;�
��A��A�
�����"��+��+���+��+�&��+
��+
�Z��@��@�8�4<�@��M��M�>��5��5�0��!B��!Brr�__main__r�)� verbosity)'�__doc__�textwraprr� itertoolsrrp�
unittest.mock�test.supportrr�testr�tkinterr>�'idlelib.idle_test.tkinter_testing_utilsr�idlelib.delegatorr �idlelib.editorr
�idlelib.percolatorr�idlelib.pyshellrlrr
r�idlelib.runr�idlelib.sidebarrrr�TestCaser.rr*�mainr!rr�<module>r�s��� ��
����,���F�'�(�)��C�C�#��:�2�2�a-�h�'�'�a-�HyB�x�(�(�yB�x�z���H�M�M�A��r
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists