Your IP : 216.73.216.196


Current Path : /opt/alt/python312/lib64/python3.12/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/idlelib/idle_test/__pycache__/test_sidebar.cpython-312.pyc

�

�#�ji��l�dZddlmZddlZddlmZddlZddlZddlm	Z	m
Z
mZddlm
Z
ddlZddlmZddlmZdd	lmZdd
lmZddlZddlmZmZmZddlmZddlZdd
lm Z m!Z!Gd�d�Z"Gd�dejF�Z$Gd�dejFe
�Z%e&dk(rejNd��yy)zTest sidebar, coverage 85%�)�dedentN)�chain)�adjust_int_max_str_digits�requires�	swap_attr)�ExtraAssertions)�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  �E/opt/alt/python312/lib64/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��r c�\�tt|jj|���Sr)�int�floatr�index)rr)s  r�	getlinenozDummy_editwin.getlineno"s���5�������/�0�1�1r N)�__name__�
__module__�__qualname__rr%r*r"r rrrs��)�
�2r rc�(�eZdZed��Zed��Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�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�|_|jjtjtjd��|jjdd��|jjdd��tj|jddtj��|_|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����r c���|jjj�|jj	�|jj�|`|`|`|`yr)rMr�closerA�update_idletasks�destroyrrrPs r�
tearDownClasszLineNumbersTest.tearDownClass9sG�������������!�!�#��������H�c�n�c�k�3�8r c����tjj�j��_ddd��_tjjj���fd�}tjjjtjjd|�}|j��j|j�d�_�fd�}tjjjtjjd|�}|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)rA�
configType�sectionrs   �r�mock_idleconf_GetFontz4LineNumbersTest.setUp.<locals>.mock_idleconf_GetFontPs����%�%�%r �GetFont)�idlelib�sidebar�LineNumbersrMr_r`�idleConfre�unittest�mock�patch�object�start�
addCleanup�stoprh)rrd�GetHighlight_patcherrk�GetFont_patcherrcs`    @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����������,�,�-r c�<�|jjdd�y�N�1.0�end)r�delete�rs r�tearDownzLineNumbersTest.tearDownWs���	�	�����&r c�f�ttt|jj	d���S)N�sel)�tuple�map�strr�
tag_rangesr�s r�
get_selectionzLineNumbersTest.get_selectionZs#���S��d�i�i�2�2�5�9�:�;�;r c�z�|jjj|�d��}|ddz}|ddz}||fS)Nz.end -1cr�r5)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�r c��|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�0r c�j�|jjjdtj�S)Nr})r_r��getr?�ENDr�s r�get_sidebar_text_contentsz)LineNumbersTest.get_sidebar_text_contentsgs#�����+�+�/�/��r�v�v�>�>r c��djtttt	d|dz��dg��}|j|j
�|�y)N�
r5�)�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�Dr c�Z�|j|jjdd�|�Sr|)r�rr�)rr�s  r�assert_text_equalsz"LineNumbersTest.assert_text_equalsns$������	�	�
�
�e�U� ;�X�F�Fr c�&�|jd�y�Nr5)r�r�s r�test_init_emptyzLineNumbersTest.test_init_emptyqs���#�#�A�&r c��|jjdd�|jd�|jd�y)N�insertzfoo bar
foo bar
foo bar
zfoo bar
foo bar
foo bar

�)rr�r�r�r�s r�test_init_not_emptyz#LineNumbersTest.test_init_not_emptyts3���	�	����=�1���� 4�5��#�#�A�&r c���|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_sidebarr�s 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�8r c�t�|jjdd�|jd�|jd�|j	�|jjdd�|jd�|jd�|j	�|jjdd�|jd	�|jd
�|j	�|jjdd�|jd�|jd
�|j	�y)Nr��foobar�foobar
r5z
foozfoobar
foo
r�zhello
hello
zfoobar
foohello
hello

r�z
worldzfoobar
foohello
hello

world
�)rr�r�r�r�r�s r�test_insertzLineNumbersTest.test_insert�s����	�	����8�,����
�+��#�#�A�&��"�"�$��	�	����7�+�����0��#�#�A�&��"�"�$��	�	����;�/���� =�>��#�#�A�&��"�"�$��	�	����9�-���� D�E��#�#�A�&��"�"�$r c�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
r5zfoo
foo
z
fbarfoo
foo

��2.0z2.endz
fbarfoo


r~zfba
r}r�)rr�r�rr�r�r�s r�test_deletezLineNumbersTest.test_delete�sU���	�	����8�,����
�+��	�	�����&�����)��#�#�A�&��"�"�$��	�	����9�-���� 2�3��#�#�A�&��"�"�$�	
�	�	�����(�����0��#�#�A�&��"�"�$��	�	�����&�����(��#�#�A�&��"�"�$�	
�	�	�����&�����%��#�#�A�&��"�"�$r c�����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)Nr9r�)r_r�r�r�s�r�	get_widthz:LineNumbersTest.test_sidebar_text_width.<locals>.get_width�s&����?�?�/�/�6�6�8��A�"�E�Er r5r��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�(r z
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�rA�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����$�$�+�+�-��	�	��������+�+�-�~�>r c�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 stepsr5N)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�rAr��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��	�	���r c��|jj�|jjdd�|jj�|j
dd�|j|j�d�y)Nr}�one
two
three
four
five
r�r��r�z5.0�	r_r�rr�rAr�r�r�r�r�s r�test_drag_selection_downz(LineNumbersTest.test_drag_selection_down+�b�����$�$�&��	�	���� ?�@��	�	����	
���1�a� �����+�+�-�~�>r c��|jj�|jjdd�|jj�|j
dd�|j|j�d�y)Nr}r�r�r�r�r�r�s r�test_drag_selection_upz&LineNumbersTest.test_drag_selection_up5r�r c��|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�rAr��yview_scrollr�r)r�r��assertNotEqualr�s 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��Or c�z�|j}|jd}d}|j||�|j�||_|j�|j
�|j|jd|�||_|j�|j|jd|�y)N�font�
TkTextFont)r_r�r�r�rh�update_fontr�r�)r�ln�	orig_font�	test_fonts    rr�zLineNumbersTest.test_fontTs���
�_�_���O�O�F�+�	� �	����I�y�1�	����&���
����	�����������0�)�<�'���
�����������0�)�<r c�L����j�t�j�}ddd�}��fd�}�j�|�_�j	��j�||��j	�||�|�_�j	�||�y)Nz#222222z#ffff00r[c����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�
	����(���
����	������,�	������,�)���
������,r N)r+r,r-�classmethodrRrWrzr�r�r�r�r�r�r�r�r�r�r�r�r�rq�skipr�r�r�r�r�r�r�r"r rr/r/&s����8��8� �<��<�.�.'�<��1�?�E�G�'�'�
9�%�*%�<B)�V�X�]�]�?�#�?�$�?��2�X�]�]�?�#�?�$�?��X�]�]�?�#�?�$�?�P�*=�.-r r/c���eZdZUdZej
ed<dZeed<e	d��Z
e	d��Ze	d��Ze	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)�ShellSidebarTestNrA�shellc��td�tj�x|_}|j	�t|�t
|�t|�t|�x|_	}|j�|j�y)Nr1)rr?r@rArBrrr
r�flistrU�
init_shell)rQrArs   rrRzShellSidebarTest.setUpClass�sc������%�%�'�!���4��
�
���D���d���d��+�D�1�1��	�E��������r c��|j�2d|j_|jj�d|_d|_|jj�|jj
�d|_y)NF)r�	executingrTrrArUrVrPs rrWzShellSidebarTest.tearDownClass�s[���9�9� �"'�C�I�I���I�I�O�O���C�I���	����!�!�#���������r c���|jj�|_d|j_|jj�t
|jjd�dz
|_y)Nr��end-1cr5)	r�
open_shellr�pollintervalrAr�rr�n_preface_linesrPs rrzShellSidebarTest.init_shell�sL���I�I�(�(�*��	�!#��	�	��������(�������B�Q�F��r c��|jjjj|jdz�d�d�|jj
j
�|jj�y)Nr5�.0r	)	rr�bottomrr�
shell_sidebar�update_sidebarrAr�rPs r�reset_shellzShellSidebarTest.reset_shell�sW���	�	�
�
���#�#�s�':�':�1�'<�&=�R�$@�(�K��	�	���.�.�0������r c���d|_tj|jjk7r4tj|_|jjt_|j	�yr)�
_saved_stdout�sys�stdoutrrr�s rrzzShellSidebarTest.setUp�sK��
"����:�:����*�*�*�!$���D�����*�*�C�J����r c�H�|j�|jt_yyr)rrrr�s rr�zShellSidebarTest.tearDown�s �����)��+�+�C�J�*r c�j�|jjj}t|j	t
j��}|D�cic]'}|j|�d|j|d���)}}|j�}|D�cgc]}|j|d���c}Scc}wcc}w)Nr5r)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�%:�;��	
r c�N�|jj}g}|jd�}|jdd�ddk7r|j|�d��}|j	|�x}�<|j|d�|j|�d��}|j	|�x}��<|S)Nr��.r5�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�=��r c���|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 )�keyr5)	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�setr4rr�s r�assert_sidebar_lines_syncedz,ShellSidebarTest.assert_sidebar_lines_synced�s2�������.�.�0�1���,�,�.�/�	
r c���|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�!=r c��|j�}|j|dgt|�dz
zdgz�|j�y)Nr5�>>>)r"r�r$r8)r�
sidebar_liness  r�test_initial_statez#ShellSidebarTest.test_initial_state�sJ���.�.�0�
�����
�F�c�-�(�1�,�-���7�	
�	
�(�(�*r c#�\K�|jd�d��|jddg�y�w)Nr�rA�r?r&r�s r�test_single_empty_inputz(ShellSidebarTest.test_single_empty_input�s'�����
�
�d��
��*�*�E�5�>�:���*,c#�\K�|jd�d��|jgd��y�w)Nz1
�rANrArEr�s r�test_single_line_statementz+ShellSidebarTest.test_single_line_statements$�����
�
�e��
��*�*�+?�@�rGc#�nK�|jtd��d��|jgd��y�w)N�7            if True:
            print(1)

            �rA�...rNrNNrA)r?rr&r�s r�test_multi_line_statementz*ShellSidebarTest.test_multi_line_statements8����	
�
�
�f���	�
	��*�*�,
�	�s�35c#�|K�|jd�d��|jgd��|j�y�w)Nz�11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
rI)r?r&r8r�s 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")
)rANNNrAr�zinsert -1line linestartz<<squeeze-current-text>>rIr)
rrr?r&�mark_setr�r8�squeezer�expandingbuttonsr4)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)
            )rArNrNz<<interrupt-execution>>)rArNrNNrAz<<history-previous>>)rArNNrAr�z
insert -2lr:z<<undo>>rAz<<redo>>rNrM)
rrr"r?rr&r�r�rSr))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#�"K�td�5t|jdd�5|jdddzzdz�d��|j	|j�dg�ddd�ddd�y#1swY�xYw#1swYyxYw�w)Nig+rTzx = �1i'r�rA)rrrr?r�r"r�s r�test_very_long_wrapped_linez,ShellSidebarTest.test_very_long_wrapped_linefsr����
&�v�
.��$�*�*�j�$�7��M�M�&�3�v�:�-��4�5�����T�3�3�5��w�?�8�/�
.�7�7��/�
.�s4�B�B�AA7�&B�.	B�7B	�<B�B�Bc�������jj�d��fd�}tjjjtjjd|���j���fd�}�j|���fd�}�j|����j��j|���y)Nr�c����Srr")rArirjr�s   �rrkz9ShellSidebarTest.test_font.<locals>.mock_idleconf_GetFontss	����r rlc�F���j��j�yr)rwr�)ryrns��r�cleanupz+ShellSidebarTest.test_font.<locals>.cleanupxs���� � �"����!r c����j}t|jtj��}|D�chc]}|j|d���}}�j
t|�d�tt|��Scc}w)Nr�r5)
rrrr?rrr�r$�next�iter)rrr�fontsrrns    ��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)rrrqrrrsrtrmrnrprurvr�r�r�)rrkrarfryrnr�s`   @@@rr�zShellSidebarTest.test_fontns�����*�*�*�*�� �	�	�"�-�-�-�-�4�4��O�O�$�$�i�1F�H������	"�	
���� �	%�	
���,�.�	�:��������)�+�Y�7r c���������jj�ddd��tjjj
���fd�}tjjjtjjd|���j���fd�}�j|���fd�}�j|����j��j|���y)NrYrZr[c�"��|dvr�S�||�S)N)r_�consoler")rarbrcr�s  ��rrdzJShellSidebarTest.test_highlight_colors.<locals>.mock_idleconf_GetHighlight�s����3�3�"�"�-�e�W�=�=r rec�F���j��j�yr)rwr�)rxrns��rraz7ShellSidebarTest.test_highlight_colors.<locals>.cleanup�s��� �%�%�'��!�!�#r c�>���j}t|jtj��}|D�chc]}|j|d���}}�j
t|�d�tt|��}|jd�}||d�Scc}w)Nr3r5r\r[)rrrr?rrr�r$rcrd�cget)rrr�fgs�fg�bgrrns      ��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)rrrmrnrprerqrrrsrtrurvr�r�r�)rrdrarprxrcrnr�s`   @@@@rr�z&ShellSidebarTest.test_highlight_colors�s�����*�*�*�*��%.�i�H��%,�_�_�%=�%=�%J�%J�"�	>� (�}�}�2�2�9�9��O�O�$�$�n�&� (��	�"�"�$�	$�	
���� �	8�	
���.�0�+�>��������+�-�{�;r c#�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�r5r�aqua�x�x11z
<Button-4>rr�r�r�z
<Button-5>)rrrr?�
assertGreaterrr�assertIsNotNoner+r)r�_windowingsystemr��assertIsNone)rrnr�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|d�|jd|�|jd	�|j|j�|j�}|j||�y�w)
NrLr�rr	�	sel.first�sel.lastz	if True:
z
1
z<<copy>>)rrrrr?r�tag_addr��assertStartsWith�assertInr�rv�clipboard_clear�
clipboard_getr�)rrnr�
first_line�
selected_text�copied_texts      r�	test_copyzShellSidebarTest.test_copy�s������*�*�*�*���z�z����'��-�
��
�
�f���	�
	����U�z�l�"�-�x�8�����j�9�
����m�\�:��
�
�g�}�-����J�'�����,�,�-��(�(�*������m�4�s�C1C3c#�K�|jj}|jj}t|�}|j	td��d��|j
d|�d�d�|jdd�}|j|d�|jdd�}|jd	�}|j�d
gdgt|�dz
zzdgz}d	jd
�t||d��D��d	z}|jd�|j|j �|j#�}	|j%|	|�y�w)Nz;            if True:
                print(1)

            r�z.3r	r|r}zTrue:
zsel.first linestartr�rArNr�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*�popr$r�r�r�rvr�r�r�)
rrnrr�r��selected_lines_text�selected_lines�expected_prompts�selected_text_with_promptsr�s
          r�test_copy_with_promptsz'ShellSidebarTest.test_copy_with_prompts�sM�����*�*�*�*���z�z����'��-�
��
�
�f���	�
	����U�z�l�"�-�x�8�����j�9�
����m�Y�7�"�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�EE)$r+r,r-rAr?r@�__annotations__rrr�rRrWrrrzr�r"r&rr4r8r?rCr	rFrJrOrQrVrZr]r�r�rzr�r�r"r rrr�s����D�"�%�%���E�7������ �����G��G�����

�,�G�
�	�8�
�1�+���;��;�
��A��A�
�����"��+��+���+��+�&��+
��+
�Z��@��@�8�4<�@��M��M�>��5��5�0��!B��!Br r�__main__r�)�	verbosity)(�__doc__�textwraprr�	itertoolsrrq�
unittest.mock�test.supportrrr�test.support.testcaser�tkinterr?�'idlelib.idle_test.tkinter_testing_utilsr	�idlelib.delegatorr
�idlelib.editorr�idlelib.percolatorr�idlelib.pyshellrmr
rr�idlelib.runr�idlelib.sidebarrrr�TestCaser/rr+�mainr"r r�<module>r�s��� ��
����G�G�1��F�'�(�)��C�C�#��:�2�2�a-�h�'�'�a-�HyB�x�(�(�/�yB�x�z���H�M�M�A��r