
    ѝi                     b   S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	J
r
  \R                  r " S S\R                  5      r " S	 S
\R                  5      rS r " S S\R                  5      r " S S\R                  5      r " S S\R                  5      r\S:X  a  \R*                  " SS9  gg)zTest editor, coverage 53%.    )editorN)
namedtuple)requires)TkTextc                   :    \ rS rSr\S 5       r\S 5       rS rSrg)EditorWindowTest   c                 l    [        S5        [        5       U l        U R                  R                  5         g Ngui)r   r   rootwithdrawclss    /lib/python3.13/idlelib/idle_test/test_editor.py
setUpClassEditorWindowTest.setUpClass   s"    4    c                     U R                   R                  5         U R                   R                  R                  SS5       H  nU R                   R	                  U5        M      U R                   R                  5         U ? g Nafterinfo)r   update_idletaskstkcallafter_canceldestroyr   ids     r   tearDownClassEditorWindowTest.tearDownClass   sX    !!#((++""7F3BHH!!"% 4Hr   c                     [        U R                  S9nU R                  UR                  U R                  5        UR                  5         g )Nr   )Editorr   assertEqual_close)selfes     r   	test_initEditorWindowTest.test_init   s1    		"+	
r    N)	__name__
__module____qualname____firstlineno__classmethodr   r!   r*   __static_attributes__r,   r   r   r	   r	      s-     
  r   r	   c                   &    \ rS rSrS rS rS rSrg)GetLineIndentTest"   c           
          S HH  nS H?  nU R                  X!S9   U R                  [        R                  " X!S9S5        S S S 5        MA     MJ     g ! , (       d  f       MW  = f)N)               ) 
)linetabwidthr?   r   r   subTestr&   r   get_line_indent)r(   r?   r>   s      r   test_empty_lines"GetLineIndentTest.test_empty_lines#   sS    'H"\\t\?$$..tG @? # (??s   %A
Ac           	          SnU HB  u  p#U R                  US9   U R                  [        R                  " USS9U5        S S S 5        MD     g ! , (       d  f       MV  = f)N)z	no spacesrA   )z    space test)r9   r9   )		tab test)r7   r9   )		double tabs test)r8   r;   )z    	mixed test   r;   )z  	  mixed test)rL   r:   )z	    mixed testrK   )  	mixed test)   r9   ) 	 mixed test)rN   rL   )	  mixed test)rN   r:   z
newline testrA   r>   r9   r@   rB   r(   testsr>   expecteds       r   test_tabwidth_4!GetLineIndentTest.test_tabwidth_4,   U    -  $ND4(  **4!< )( $((   &A
A	c           	          SnU HB  u  p#U R                  US9   U R                  [        R                  " USS9U5        S S S 5        MD     g ! , (       d  f       MV  = f)N)rH   )z        space test)r;   r;   )rI   )r7   r;   )rJ   )r8      )z        	mixed test	   r[   )z      	  mixed test)r]   
   )z	        mixed testr\   )rM   )rN   r;   )rO   )rN   r]   )rP   )rN   r^   rQ   rR   r;   r@   rB   rS   s       r   test_tabwidth_8!GetLineIndentTest.test_tabwidth_8E   rX   rY   r,   N)r-   r.   r/   r0   rE   rV   r_   r2   r,   r   r   r4   r4   "   s    2r   r4   c                 l    U R                  SS5        U R                  SU5        U R                  5         g )N1.0end)deleteinsertr   )textstrings     r   re   re   _   s*    KKuKKvr   c                   :    \ rS rSr\S 5       r\S 5       rS rSrg)IndentAndNewlineTeste   c                     [        S5        [        5       U l        U R                  R                  5         [	        U R                  S9U l        SU R
                  l        SU R
                  l        g )Nr   r$   r8   )r   r   r   r   r%   windowindentwidthr?   r   s    r   r   IndentAndNewlineTest.setUpClassg   sJ    4*
!"



r   c                 8   U R                   R                  5         U ? U R                  R                  5         U R                  R                  R                  SS5       H  nU R                  R                  U5        M      U R                  R                  5         U ?g r   rl   r'   r   r   r   r   r   r   r   s     r   r!   "IndentAndNewlineTest.tearDownClassp   m    

J!!#((++""7F3BHH!!"% 4Hr   c                    U R                   nU R                  nUR                  nUR                  nUR                  n[        S/ SQ5      nU" SSSS5      U" SSS	S
5      U" SSS	S5      U" SSSS5      U" SSSS5      U" SSSS5      U" SSSS5      U" SSSS5      U" SSSS5      4	nU Hv  nU R                  UR                  S 9   [        X8R                  5        UR                  S!UR                  5        U" S S"9  U" U" S#S$5      UR                  5        S S S 5        Mx     [        US%5        UR                  S&S'S5        U" S 5        U" U" S#S$5      S(5        g ! , (       d  f       M  = f))NTests)labelrf   rU   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
  
)ru   re   )eventrb   rc   z&  def f1(self, a, b):
    return a + bselz1.17z-  def f1(self, a,
         
    return a + b
)r&   rl   rf   getnewline_and_indent_eventr   rC   ru   re   mark_setrv   rU   tag_add)	r(   eqwrf   ry   nlTestInforT   tests	            r   test_indent_and_newline_event2IndentAndNewlineTest.test_indent_and_newline_eventz   s   KKvvhh''g'LM>59!# G1= " F1= " D.2 " BBH " 4!'!# >8F!# <5=!# <5;!#A$L DDJJ/tYY'h		23ue$dmm4	 0/  	t>?UFG,
4
3uePQ 0/s   AE
E*	r,   N)	r-   r.   r/   r0   r1   r   r!   r   r2   r,   r   r   ri   ri   e   s.         ;Rr   ri   c                   :    \ rS rSr\S 5       r\S 5       rS rSrg)IndentSearcherTest   c                     [        S5        [        5       U l        U R                  R                  5         [	        U R                  5      U l        g r   )r   r   r   r   r   rf   r   s    r   r   IndentSearcherTest.setUpClass   s1    4>r   c                 <    U R                   R                  5         U ? g N)r   r   r   s    r   r!    IndentSearcherTest.tearDownClass   s    Hr   c                 "   U R                   nU R                   nSnU H]  u  pEU R                  US9   [        X5        [        R                  " U5      R                  5       nU R                  Xe5        S S S 5        M_     g ! , (       d  f       Mq  = f)N))r<   NN)z[1,r   )if 1:
)r   N)zif 1:
  2
  3
)r   z  2
)code)rf   rC   re   r   IndentSearcherrunr&   )r(   rf   searcher	test_infor   expected_pairactual_pairs          r   test_searcher IndentSearcherTest.test_searcher   sv    yyII	 $-D4(t"$33D9==?  < )( $-((s   AA??
B	r,   N)	r-   r.   r/   r0   r1   r   r!   r   r2   r,   r   r   r   r      s-    " "  =r   r   c                   N    \ rS rSr\S 5       r\S 5       r " S S5      rS rSr	g)		RMenuTest   c                     [        S5        [        5       U l        U R                  R                  5         [	        U R                  S9U l        g )Nr   r$   )r   r   r   r   r%   rl   r   s    r   r   RMenuTest.setUpClass   s2    4*
r   c                 8   U R                   R                  5         U ? U R                  R                  5         U R                  R                  R                  SS5       H  nU R                  R                  U5        M      U R                  R                  5         U ?g r   rp   r   s     r   r!   RMenuTest.tearDownClass   rr   r   c                       \ rS rSrS rSrg)RMenuTest.DummyRMenu   c                     g r   r,   )xys     r   tk_popupRMenuTest.DummyRMenu.tk_popup   s    Dr   r,   N)r-   r.   r/   r0   r   r2   r,   r   r   
DummyRMenur      s     r   r   c                     g r   r,   )r(   s    r   test_rclickRMenuTest.test_rclick   s    r   r,   N)
r-   r.   r/   r0   r1   r   r!   r   r   r2   r,   r   r   r   r      s7    + +  ! !r   r   __main__r8   )	verbosity)__doc__idlelibr   unittestcollectionsr   test.supportr   tkinterr   r   EditorWindowr%   TestCaser	   r4   re   ri   r   r   r-   mainr,   r   r   <module>r      s       " ! 			x(( ,:)) :zPR8,, PRf=** =<!! 4 zMMA r   