
    ch                     J   d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	m
Z
 ej        Z G d dej                  Z G d	 d
ej                  Zd Z G d dej                  Z G d dej                  Z G d dej                  Zedk    r ej        d           dS dS )zTest editor, coverage 53%.    )editorN)
namedtuple)requires)TkTextc                   @    e Zd Zed             Zed             Zd ZdS )EditorWindowTestc                 |    t          d           t                      | _        | j                                         d S Ngui)r   r   rootwithdrawclss    /  /home/conda/feedstock_root/build_artifacts/python-split_1761172146731/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.11/idlelib/idle_test/test_editor.py
setUpClasszEditorWindowTest.setUpClass   s2    44    c                     | j                                          | j         j                            dd          D ]}| j                             |           | j                                          | ` d S Nafterinfo)r   update_idletaskstkcallafter_canceldestroyr   ids     r   tearDownClasszEditorWindowTest.tearDownClass   so    !!###(+""7F33 	& 	&BH!!"%%%%HHHr   c                     t          | j                  }|                     |j        | j                   |                                 d S )Nr   )Editorr   assertEqual_close)selfes     r   	test_initzEditorWindowTest.test_init   s?    	"""+++	




r   N)__name__
__module____qualname__classmethodr   r   r'    r   r   r	   r	      sW          [
   [    r   r	   c                        e Zd Zd Zd Zd ZdS )GetLineIndentTestc           	          dD ]`}dD ][}|                      ||          5  |                     t          j        ||          d           d d d            n# 1 swxY w Y   \ad S )N)               ) 
)linetabwidthr8   r   r   subTestr#   r   get_line_indent)r%   r8   r7   s      r   test_empty_linesz"GetLineIndentTest.test_empty_lines#   s    ' 	 	H"  \\th\??  $$.thGGG                	 	s   +AAAc                     d}|D ]]\  }}|                      |          5  |                     t          j        |d          |           d d d            n# 1 swxY w Y   ^d S )N)z	no spacesr:   )z    space test)r2   r2   )		tab test)r0   r2   )		double tabs test)r1   r4   )z    	mixed test   r4   )z  	  mixed test)rD   r3   )z	    mixed testrC   )  	mixed test)   r2   ) 	 mixed test)rF   rD   )	  mixed test)rF   r3   z
newline testr:   r7   r2   r9   r;   r%   testsr7   expecteds       r   test_tabwidth_4z!GetLineIndentTest.test_tabwidth_4,       -  $ 	 	ND(4((    *4!<<<                	 	   +AA	A	c                     d}|D ]]\  }}|                      |          5  |                     t          j        |d          |           d d d            n# 1 swxY w Y   ^d S )N)r@   )z        space test)r4   r4   )rA   )r0   r4   )rB   )r1      )z        	mixed test	   rR   )z      	  mixed test)rT   
   )z	        mixed testrS   )rE   )rF   r4   )rG   )rF   rT   )rH   )rF   rU   rI   rJ   r4   r9   r;   rK   s       r   test_tabwidth_8z!GetLineIndentTest.test_tabwidth_8E   rO   rP   N)r(   r)   r*   r>   rN   rV   r,   r   r   r.   r.   "   sA            2    r   r.   c                     |                      dd           |                     d|           |                                  d S )N1.0end)deleteinsertr   )textstrings     r   r[   r[   _   sB    KKuKKvr   c                   @    e Zd Zed             Zed             Zd ZdS )IndentAndNewlineTestc                     t          d           t                      | _        | j                                         t	          | j                  | _        d| j        _        d| j        _        d S )Nr   r!   r1   )r   r   r   r   r"   windowindentwidthr8   r   s    r   r   zIndentAndNewlineTest.setUpClassg   sZ    44***
!"

r   c                    | j                                          | ` | j                                         | j        j                            dd          D ]}| j                            |           | j                                         | `d S r   ra   r$   r   r   r   r   r   r   r   s     r   r   z"IndentAndNewlineTest.tearDownClassp       
J!!###(+""7F33 	& 	&BH!!"%%%%HHHr   c                    | j         }| j        }|j        }|j        }|j        }t          dg d          } |dddd           |ddd	d
           |ddd	d           |dddd           |dddd           |dddd           |dddd           |dddd           |dddd          f	}|D ]}|                     |j                   5  t          ||j                   |	                    d!|j
                    |d "            | |d#d$          |j                   d d d            n# 1 swxY w Y   t          |d%           |                    d&d'd            |d             | |d#d$          d(           d S ))NTests)labelr\   rM   markz"Empty line inserts with no indent.z  
  def __init__(self):z
  
  def __init__(self):
z1.endz+Inside bracket before space, deletes space.z  def f1(self, a, b):z  def f1(self,
         a, b):
z1.14z*Inside bracket after space, deletes space.z1.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
  """
z2.18zBackslash with one line.za =\za =\
  
z"Backslash with more than one line.za =\
          multiline\z%a =\
          multiline\
          
z2.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
  
)rh   r[   )eventrX   rY   z&  def f1(self, a, b):
    return a + bselz1.17z-  def f1(self, a,
         
    return a + b
)r#   ra   r\   getnewline_and_indent_eventr   r<   rh   r[   mark_setri   rM   tag_add)	r%   eqwr\   rl   nlTestInforL   tests	            r   test_indent_and_newline_eventz2IndentAndNewlineTest.test_indent_and_newline_eventz   sx   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 	5DDJ// 5 5tTY'''h	22233ue$$dm444	5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 	t>???UFG,,,
4
33uePQQQQQs   AD00D4	7D4	N)r(   r)   r*   r+   r   r   ru   r,   r   r   r_   r_   e   s\            [    [;R ;R ;R ;R ;Rr   r_   c                   @    e Zd Zed             Zed             Zd ZdS )IndentSearcherTestc                     t          d           t                      | _        | j                                         t	          | j                  | _        d S r   )r   r   r   r   r   r\   r   s    r   r   zIndentSearcherTest.setUpClass   s?    44>>r   c                 <    | j                                          | ` d S N)r   r   r   s    r   r   z IndentSearcherTest.tearDownClass   s    HHHr   c                 *   | j         }| j         }d}|D ]\  }}|                     |          5  t          ||           t          j        |                                          }|                     ||           d d d            n# 1 swxY w Y   d S )N))r5   NN)z[1,r|   )if 1:
)r}   N)zif 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(( = =tT"""$3D99==??  m<<<= = = = = = = = = = = = = = =	= 	=s   ABB	B	N)r(   r)   r*   r+   r   r   r   r,   r   r   rw   rw      sW        " " ["   [= = = = =r   rw   c                   Z    e Zd Zed             Zed             Z G d d          Zd ZdS )	RMenuTestc                     t          d           t                      | _        | j                                         t	          | j                  | _        d S )Nr   r!   )r   r   r   r   r"   ra   r   s    r   r   zRMenuTest.setUpClass   sD    44***


r   c                    | j                                          | ` | j                                         | j        j                            dd          D ]}| j                            |           | j                                         | `d S r   rd   r   s     r   r   zRMenuTest.tearDownClass   re   r   c                       e Zd Zd ZdS )RMenuTest.DummyRMenuc                     d S rz   r,   )xys     r   tk_popupzRMenuTest.DummyRMenu.tk_popup   s      r   N)r(   r)   r*   r   r,   r   r   
DummyRMenur      s             r   r   c                     d S rz   r,   )r%   s    r   test_rclickzRMenuTest.test_rclick   s    r   N)r(   r)   r*   r+   r   r   r   r   r,   r   r   r   r      s        + + [+   [! ! ! ! ! ! ! !    r   r   __main__r1   )	verbosity)__doc__idlelibr   unittestcollectionsr   test.supportr   tkinterr   r   EditorWindowr"   TestCaser	   r.   r[   r_   rw   r   r(   mainr,   r   r   <module>r      s            " " " " " " ! ! ! ! ! !        		    x(   ,: : : : :) : : :z  PR PR PR PR PR8, PR PR PRf= = = = =* = = =<    !   4 zHMA r   