
    ;e                         d Z ddlmZ ddlZddlmZ ddlmZmZ  G d d          Z	 G d d	ej
                  Zed
k    r ej        d           dS dS )zTest autoexpand, coverage 100%.    )
AutoExpandN)requires)TextTkc                       e Zd Zd ZdS )DummyEditwinc                     || _         d S N)text)selfr   s     8/usr/lib/python3.11/idlelib/idle_test/test_autoexpand.py__init__zDummyEditwin.__init__   s    			    N)__name__
__module____qualname__r    r   r   r   r   	   s#            r   r   c                   ^    e Zd Zed             Zed             Zd Zd Zd Zd Z	d Z
d Zd	S )
AutoExpandTestc                     t          d           t                      | _        t          | j                  | _        t          t          | j                            | _        d | j        _        d S )Nguic                      d S r
   r   r   r   r   <lambda>z+AutoExpandTest.setUpClass.<locals>.<lambda>   s    t r   )	r   r   tkr   r   r   r   auto_expandbellclss    r   
setUpClasszAutoExpandTest.setUpClass   sR    <<$\#(%;%;<<+|r   c                 h    | ` | `t          | d          r| j                                         | `d S d S )Nr   )r   r   hasattrr   destroyr   s    r   tearDownClasszAutoExpandTest.tearDownClass'   sB    Hco3 	FNN	 	r   c                 <    | j                             dd           d S )N1.0end)r   delete)r   s    r   tearDownzAutoExpandTest.tearDown.   s     	&&&&&r   c                    | j         }| j        j        }| j        } | |            d           |                    dd            | |            d           |                    dd            | |            d           |                    dd            | |            d           |                    dd            | |            d           |                    dd            | |            d	           |                    d
d            | |            d           |                    dd            | |            d           d S )N insertthisthis isz
sample
stringstringz3.0r%   r&   )r   r   getprevwordassertEqualr+   r'   )r   r   previousequals       r   test_get_prevwordz AutoExpandTest.test_get_prevword1   so   y#/ hhjj"Hc"""hhjj#He$$$hhjj&!!!Hc"""hhjj"Hd###hhjj$H0111hhjj(###E8$$$hhjj"E5!!!hhjj"r   c                    | j         j        }| j         j        }| j        }| j                            dd            || j                                         g d            |d            | |            d            |d            | |            d            |d            | |            d            |d            | |            d           d S )	Nr+   zab ac bx ad ab a)abadacaeventr8   r9   r:   r;   )r   r2   expand_word_eventr3   r   r+   getwords)r   r4   expandr5   s       r   test_before_onlyzAutoExpandTest.test_before_onlyM   s    #/!3 	#5666d''))+B+B+BCCCwhhjj$whhjj$whhjj$whhjj#r   c                    | j         }| j        j        }| j        j        }| j        }|                    dd           |                    dd            || j                                        g d            |d            | |            d            |d            | |            d            |d            | |            d            |d            | |            d	           d S )
Nr+   z a, [ab] ac: () bx"" cd ac= ad yaz1.1)r8   r:   r9   r;   r<   r8   r:   r9   r;   r   r   r2   r=   r3   r+   mark_setr>   r   r   r4   r?   r5   s        r   test_after_onlyzAutoExpandTest.test_after_only]   s   y#/!3 H@AAAh&&&d''))+B+B+BCCCwhhjj$whhjj$whhjj$whhjj#r   c                    | j         }| j        j        }| j        j        }| j        }|                    dd           |                    dd           |                    dd            || j                                        g d            |d            | |            d            |d            | |            d            |d            | |            d	           d S )
Nr+   z	ab xy yz
z
a ac by acz2.1)r8   r:   r;   r<   r8   r:   r;   rB   rD   s        r   test_both_before_afterz%AutoExpandTest.test_both_before_afterp   s    y#/!3 Hl+++Hl+++h&&&d''))+<+<+<===whhjj$whhjj$whhjj#r   c                 (   | j         }| j        j        }| j        } || j                                        g             | |d          d           |                    dd            || j                                        g            |                    dd           |                    dd            |d           | j        j        }|                    dd            |d           | j        j        }|                     ||           d S )Nr<   breakr+   z
bx cy dz azac xy a ac ad az1.7z1.end)	r   r   r=   r3   r>   r+   rC   stateassertNotEqual)r   r   r?   r5   initial_state	new_states         r   test_other_expand_casesz&AutoExpandTest.test_other_expand_cases   s   y!3  	d''))2...ffWoow'''Hl+++d''))2... 	H/000h&&&w(.h(((w$*	M955555r   N)r   r   r   classmethodr   r#   r(   r6   r@   rE   rG   rN   r   r   r   r   r      s        , , [,,   [' ' '  8     &  $6 6 6 6 6r   r   __main__   )	verbosity)__doc__idlelib.autoexpandr   unittesttest.supportr   tkinterr   r   r   TestCaser   r   mainr   r   r   <module>rZ      s    ! ! ) ) ) ) ) )  ! ! ! ! ! !               
I6 I6 I6 I6 I6X& I6 I6 I6X zHMA r   