
    ;ee                         d Z ddlmZ ddlZddlmZ ddlm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 pyshell, coverage 12%.    )pyshellN)requires)Tkc                       e Zd Zd Zd ZdS )FunctionTestc           
      $   | j         }dD ]\  }}}d}|dz  }|                     ||          5  |pd}t          j        ||          } |t	          |          |            ||||z    d| d|            d d d            n# 1 swxY w Y   d S )N))    r	   )finame   =<   r   )filebarShellz
 RESTART:  )assertEqualsubTestr   restart_linelen)selfeqr   mulextrawidthr   lines           5/usr/lib/python3.11/idlelib/idle_test/test_pyshell.pytest_restart_line_widez#FunctionTest.test_restart_line_wide   s    C 	? 	?D#uE)C4S11 ? ?w+E4883t99e$$$4CI======>>>	? ? ? ? ? ? ? ? ? ? ? ? ? ? ?	? 	?s   A
BB	B	c                 8   d\  }}|dz
  ||dz   fD ]Y}|                      |          5  |                     t          j        |d          |           d d d            n# 1 swxY w Y   Z|                     t          j        |dz   d          |dz              d S )N)z= RESTART: Shell      )r   r	      z =)r   r   r   r   )r   expecttaglenr   s       r   test_restart_line_narrowz%FunctionTest.test_restart_line_narrow   s    /Qhq1 	J 	JEE** J J  !5eR!@!@&IIIJ J J J J J J J J J J J J J J-fQh;;VD[IIIIIs   *AA#	&A#	N)__name__
__module____qualname__r   r%        r   r   r   
   s7        	? 	? 	?J J J J Jr*   r   c                   @    e Zd Zed             Zed             Zd ZdS )PyShellFileListTestc                 |    t          d           t                      | _        | j                                         d S )Ngui)r   r   rootwithdrawclss    r   
setUpClasszPyShellFileListTest.setUpClass"   s2    44r*   c                 <    | j                                          | ` d S N)r/   destroyr1   s    r   tearDownClassz!PyShellFileListTest.tearDownClass(   s!    
 	HHHr*   c                     t          j        | j                  }|                     |j        t           j                   |                     |j                    d S r5   )r   PyShellFileListr/   r   EditorWindowPyShellEditorWindowassertIsNone)r   psfls     r   	test_initzPyShellFileListTest.test_init0   sL    &ty11*G,GHHH$,'''''r*   N)r&   r'   r(   classmethodr3   r7   r>   r)   r*   r   r,   r,       sW          [
   [( ( ( ( (r*   r,   c                   b    e Zd Zej        j        Zd Zd Zd Z	d Z
d Zd Zd Zd Zd	 Zd
 ZdS )4PyShellRemoveLastNewlineAndSurroundingWhitespaceTestc                 d    |                      d| j                            d|                     d S Nr	   r   regexpsubr   texts     r   all_removedz@PyShellRemoveLastNewlineAndSurroundingWhitespaceTest.all_removedB   s.    T[__R6677777r*   c                 d    |                      || j                            d|                     d S rC   rD   rG   s     r   none_removedzAPyShellRemoveLastNewlineAndSurroundingWhitespaceTest.none_removedE   s.    t{r48899999r*   c                 d    |                      || j                            d|                     d S rC   rD   )r   rH   expecteds      r   check_resultzAPyShellRemoveLastNewlineAndSurroundingWhitespaceTest.check_resultH   s.    4;??2t#<#<=====r*   c                 0    |                      d           d S rC   rI   r   s    r   
test_emptyz?PyShellRemoveLastNewlineAndSurroundingWhitespaceTest.test_emptyK   s    r*   c                 0    |                      d           d S )N
rP   rQ   s    r   test_newlinezAPyShellRemoveLastNewlineAndSurroundingWhitespaceTest.test_newlineN   s    r*   c                    |                      d           |                      d           |                      d           |                      d           |                      d           |                      d           |                      d           |                      d           |                      d	           |                      d
           |                      d           |                      d           d S )Nr   z  z   z                    	z		z			z																				z	 z 	z 	 	 z	 	 	rP   rQ   s    r   test_whitespace_no_newlinezOPyShellRemoveLastNewlineAndSurroundingWhitespaceTest.test_whitespace_no_newlineQ   s    """   """######$$$$$r*   c                    |                      d           |                      d           |                      d           |                      d           |                      d           |                      d           |                      d           |                      d           |                      d	           |                      d
           |                      d           |                      d           |                      d           |                      d           |                      d           |                      d           d S )N 
	
z 	
z	 
z
 z
	z
 	z
	 z 
 z	
 z 
	z	
	z	 	 	
z 	 	 
z
	 	 	z
 	 	 rP   rQ   s    r   test_newline_with_whitespacezQPyShellRemoveLastNewlineAndSurroundingWhitespaceTest.test_newline_with_whitespace_   sH      !!!!!!   !!!!!!   !!!!!!"""&&&%%%&&&%%%%%r*   c                 B   |                      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 S )Nz

rT   z




z



z




	z



















z


















z



















 z 
 
 rZ   z 

 z 

z	

r[   z

 z

	z	
	
	)rN   rQ   s    r   test_multiple_newlineszKPyShellRemoveLastNewlineAndSurroundingWhitespaceTest.test_multiple_newlinesq   s&   &$'''(H---/8444)Y////9555)U+++(E***'5)))(F+++'4((((D))))U+++,/////r*   c                    |                      d           |                     dd           |                     dd           |                     dd           |                     dd           |                      d           |                     dd           |                      d           |                     d	d           d S )
Naza
za
 za 
 za 
	-z-
.z.
rK   rN   rQ   s    r   test_non_whitespacezHPyShellRemoveLastNewlineAndSurroundingWhitespaceTest.test_non_whitespace   s    #%%%%&#&&&'3'''(C(((#%%%%#%%%%%%r*   c                     |                      d           |                      d           |                     dd           |                      d           |                     dd           d S )Nz
z
z 
z
 rc   rQ   s    r   test_unsupported_whitespacezPPyShellRemoveLastNewlineAndSurroundingWhitespaceTest.test_unsupported_whitespace   sp    $&!!!&$''''"""'4(((((r*   N)r&   r'   r(   r   PyShell_last_newline_rerE   rI   rK   rN   rR   rU   rX   r\   r^   rd   rg   r)   r*   r   rA   rA   ?   s        _-F8 8 8: : :> > >    % % %& & &$0 0 0	& 	& 	&) ) ) ) )r*   rA   __main__r"   )	verbosity)__doc__idlelibr   unittesttest.supportr   tkinterr   TestCaser   r,   rA   r&   mainr)   r*   r   <module>rs      s            ! ! ! ! ! !      J J J J J8$ J J J,( ( ( ( ((+ ( ( (>Q) Q) Q) Q) Q)8;L Q) Q) Q)h zHMA r*   