Your IP : 216.73.216.213


Current Path : /opt/alt/python311/lib64/python3.11/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/idlelib/idle_test/__pycache__/test_editor.cpython-311.pyc

�

�0�i���J�dZddlmZddlZddlmZddlmZddlm	Z	m
Z
ejZGd�dej
��ZGd	�d
ej
��Zd�ZGd�d
ej
��ZGd�dej
��ZGd�dej
��Zedkrejd���dSdS)zTest editor, coverage 53%.�)�editorN)�
namedtuple)�requires)�Tk�Textc�@�eZdZed���Zed���Zd�ZdS)�EditorWindowTestc�|�td��t��|_|j���dS�N�gui)rr�root�withdraw��clss �D/opt/alt/python311/lib64/python3.11/idlelib/idle_test/test_editor.py�
setUpClasszEditorWindowTest.setUpClasss2��������4�4������������c���|j���|jj�dd��D]}|j�|���|j���|`dS�N�after�info)r
�update_idletasks�tk�call�after_cancel�destroy�r�ids  r�
tearDownClasszEditorWindowTest.tearDownClassso����!�!�#�#�#��(�+�"�"�7�F�3�3�	&�	&�B��H�!�!�"�%�%�%�%���������H�H�Hrc��t|j���}|�|j|j��|���dS)N�r
)�Editorr
�assertEqual�_close)�self�es  r�	test_initzEditorWindowTest.test_inits?����	�"�"�"���������+�+�+�	���
�
�
�
�
rN)�__name__�
__module__�__qualname__�classmethodrrr'�rrr	r	sW����������[��
����[������rr	c� �eZdZd�Zd�Zd�ZdS)�GetLineIndentTestc	���dD]`}dD][}|�||���5|�tj||���d��ddd��n#1swxYwY�\�adS)N)�����)��
)�line�tabwidth�r8�rr��subTestr#r�get_line_indent)r%r8r7s   r�test_empty_linesz"GetLineIndentTest.test_empty_lines#s���'�	�	�H�"�
�
���\�\�t�h�\�?�?����$�$��.�t�h�G�G�G������������������������
�	�	s�+A�A�Ac���d}|D]]\}}|�|���5|�tj|d���|��ddd��n#1swxYwY�^dS)N)�z	no spacesr:)z    space test)r2r2)�		tab test)r0r2)�		double tabs test)r1r4)z    	mixed test��r4)z  	  mixed test)rDr3)z	    mixed testrC)�
  	mixed test)�r2)�
 	 mixed test)rFrD)�
	  mixed test)rFr3�z
newline testr:�r7r2r9r;�r%�testsr7�expecteds    r�test_tabwidth_4z!GetLineIndentTest.test_tabwidth_4,���-�� $�	�	�N�D�(����4��(�(�
�
�� � ��*�4�!�<�<�<�����
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��	�	��+A�A	�A	c���d}|D]]\}}|�|���5|�tj|d���|��ddd��n#1swxYwY�^dS)N)r@)z        space test)r4r4)rA)r0r4)rB)r1�)z        	mixed test��	rR)z      	  mixed test)rT�
)z	        mixed testrS)rE)rFr4)rG)rFrT)rH)rFrUrIrJr4r9r;rKs    r�test_tabwidth_8z!GetLineIndentTest.test_tabwidth_8ErOrPN)r(r)r*r>rNrVr,rrr.r."sA������������2����rr.c��|�dd��|�d|��|���dS)N�1.0�end)�delete�insertr)�text�strings  rr[r[_sB���K�K��u�����K�K��v�����������rc�@�eZdZed���Zed���Zd�ZdS)�IndentAndNewlineTestc���td��t��|_|j���t	|j���|_d|j_d|j_dS)Nrr!r1)rrr
rr"�window�indentwidthr8rs rrzIndentAndNewlineTest.setUpClassgsZ��������4�4�������������*�*�*��
�!"��
����
���rc��|j���|`|j���|jj�dd��D]}|j�|���|j���|`dSr�rar$r
rrrrrrs  rrz"IndentAndNewlineTest.tearDownClassp����
�������J���!�!�#�#�#��(�+�"�"�7�F�3�3�	&�	&�B��H�!�!�"�%�%�%�%���������H�H�Hrc��|j}|j}|j}|j}|j}tdgd���}|dddd��|ddd	d
��|ddd	d��|d
ddd��|dddd��|dddd��|dddd��|dddd��|dddd��f	}|D]�}|�|j� ��5t||j��|�	d!|j
��|d�"��||d#d$��|j��ddd��n#1swxYwY��t|d%��|�d&d'd��|d��||d#d$��d(��dS))N�Tests)�labelr\rM�markz"Empty line inserts with no indent.z  
  def __init__(self):z
  
  def __init__(self):
z1.endz+Inside bracket before space, deletes space.z  def f1(self, a, b):z  def f1(self,
         a, b):
z1.14z*Inside bracket after space, deletes space.z1.15z(Inside string with one line - no indent.z  """Docstring."""z  """Docstring.
"""
z&Inside string with more than one line.z%  """Docstring.
  Docstring Line 2"""z)  """Docstring.
  Docstring Line 2
  """
z2.18zBackslash with one line.za =\za =\
  
z"Backslash with more than one line.za =\
          multiline\z%a =\
          multiline\
          
z2.endz Block opener - indents +1 level.z  def f1(self):
    passz  def f1(self):
    
    pass
z Block closer - dedents -1 level.z  def f1(self):
    pass
  
)rhr[)�eventrXrYz&  def f1(self, a, b):
    return a + b�selz1.17z-  def f1(self, a,
         
    return a + b
)
r#rar\�get�newline_and_indent_eventrr<rhr[�mark_setrirM�tag_add)	r%�eq�wr\rl�nl�TestInforL�tests	         r�test_indent_and_newline_eventz2IndentAndNewlineTest.test_indent_and_newline_eventzsx��
�
���K���v���h��
�
'���g�'L�'L�'L�M�M����>�5�9�!�#�#���G�1�=� �"�"���F�1�=� �"�"���D�.�2� �"�"���B�B�H� �"�"���4�!�'�!�#�#���>�8�F�!�#�#���<�5�=�!�#�#���<�5�;�!�#�#�A$��L�	5�	5�D����D�J��/�/�
5�
5��t�T�Y�'�'�'��
�
�h��	�2�2�2����������3�3�u�e�$�$�d�m�4�4�4�	
5�
5�
5�
5�
5�
5�
5�
5�
5�
5�
5����
5�
5�
5�
5��	�t�>�?�?�?����U�F�G�,�,�,�
��4����
��3�3�u�e���P�Q�Q�Q�Q�Qs�AD0�0D4	�7D4	N)r(r)r*r+rrrur,rrr_r_es\������� � ��[� �����[��;R�;R�;R�;R�;Rrr_c�@�eZdZed���Zed���Zd�ZdS)�IndentSearcherTestc��td��t��|_|j���t	|j��|_dSr)rrr
rrr\rs rrzIndentSearcherTest.setUpClass�s?��������4�4�������������>�>����rc�<�|j���|`dS�N)r
rrs rrz IndentSearcherTest.tearDownClass�s����������H�H�Hrc�*�|j}|j}d}|D]\}}|�|���5t||��tj|�����}|�||��ddd��n#1swxYwY��dS)N))r5�NN)z[1,r|)�if 1:
)r}N)zif 1:
  2
  3
)r}z  2
)�code)r\r<r[r�IndentSearcher�runr#)r%r\�searcher�	test_infor~�
expected_pair�actual_pairs       r�
test_searcherz IndentSearcherTest.test_searcher�s����y���I���	�$-�	=�	=��D�-����4��(�(�
=�
=��t�T�"�"�"�$�3�D�9�9�=�=�?�?��� � ��m�<�<�<�
=�
=�
=�
=�
=�
=�
=�
=�
=�
=�
=����
=�
=�
=�
=��	=�	=s�A
B�B	�B	N)r(r)r*r+rrr�r,rrrwrw�sW�������"�"��[�"�����[��
=�
=�
=�
=�
=rrwc�Z�eZdZed���Zed���ZGd�d��Zd�ZdS)�	RMenuTestc��td��t��|_|j���t	|j���|_dS)Nrr!)rrr
rr"rars rrzRMenuTest.setUpClass�sD��������4�4�������������*�*�*��
�
�
rc��|j���|`|j���|jj�dd��D]}|j�|���|j���|`dSrrdrs  rrzRMenuTest.tearDownClass�rerc��eZdZd�ZdS)�RMenuTest.DummyRMenuc��dSrzr,)�x�ys  r�tk_popupzRMenuTest.DummyRMenu.tk_popup�s���rN)r(r)r*r�r,rr�
DummyRMenur��s������ � � � � rr�c��dSrzr,)r%s r�test_rclickzRMenuTest.test_rclick�s���rN)r(r)r*r+rrr�r�r,rrr�r��s�������+�+��[�+�����[��!�!�!�!�!�!�!�!�
�
�
�
�
rr��__main__r1)�	verbosity)�__doc__�idlelibr�unittest�collectionsr�test.supportr�tkinterrr�EditorWindowr"�TestCaser	r.r[r_rwr�r(�mainr,rr�<module>r�s���������������"�"�"�"�"�"�!�!�!�!�!�!���������	�	�������x�(����,:�:�:�:�:��)�:�:�:�z���PR�PR�PR�PR�PR�8�,�PR�PR�PR�f=�=�=�=�=��*�=�=�=�<
�
�
�
�
��!�
�
�
�4�z����H�M�A��������r