
    ;e;                         d Z ddlZddlmZ ddlmZmZmZ ddlm	Z	 ddl
mZ ddl
mZ ddlmZ  G d	 d
ej                  Zedk    r ej        dd           dS dS )zTest searchbase, coverage 98%.    N)requires)TextTkToplevel)Frame)searchengine)
searchbase)Funcc                       e Zd Zed             Zed             Zd Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zd Zd Zd ZdS )SearchDialogBaseTestc                 J    t          d           t                      | _        d S )Ngui)r   r   rootclss    8/usr/lib/python3.11/idlelib/idle_test/test_searchbase.py
setUpClasszSearchDialogBaseTest.setUpClass   s    44    c                 n    | j                                          | j                                          | ` d S N)r   update_idletasksdestroyr   s    r   tearDownClassz"SearchDialogBaseTest.tearDownClass!   s3    !!###HHHr   c                     t          j        | j                  | _        t	          j        | j        | j                  | _        d S )N)r   engine)seSearchEnginer   r   sdbSearchDialogBasedialogselfs    r   setUpzSearchDialogBaseTest.setUp'   s4    odi00*	$+NNNr   c                 8    | j                                          d S r   )r    closer!   s    r   tearDownzSearchDialogBaseTest.tearDown+   s    r   c                 ~   d | j         _        t          | j                  }t	          |          }| j                             |           |                     | j         j                                        d           | j         	                                 |                     | j         j                                        d           | j                             |d           |                     | j         j
                                        d           |                                 |                                 d S )Nnormal	withdrawnhello)searchphrase)r    default_commandr   r   r   openassertEqualtopstater%   entgetr   r   )r"   topleveltexts      r   test_open_and_closez(SearchDialogBaseTest.test_open_and_close.   s   &*#DI&&H~~..00(;;;..00+>>>G444,,..888!!###r   c                 0   t                      | j        _        t                      | j        _        t                      | j        _        t                      | j        _        d | j        _        | j                                         |                     | j        j        j	                   |                     | j        j        j	                   |                     | j        j        j	                   |                     | j        j        j	                   d S r   )
r
   r    create_entriescreate_option_buttonscreate_other_buttonscreate_command_buttonsr,   create_widgets
assertTruecalledr!   s    r   test_create_widgetsz(SearchDialogBaseTest.test_create_widgets>   s    %)VV",0FF)+/66(-1VV*&*#""$$$29:::9@AAA8?@@@:ABBBBBr   c                 d   | j         }d| j        _        t          | j                  | j        _        | j                            dd          \  }} ||d         d           |                     |                                d           |	                                } |t          |d                   d            |t          |d                   d            |t          |d                   d            |t          |d	                   d            || j        j        d           d S )
Nr   zTest:r*   r4   rowcolumn   rowspan
columnspan)r.   r    r@   r   r   frame
make_entryassertInr2   	grid_infoint)r"   equalentrylabelegis        r   test_make_entryz$SearchDialogBaseTest.test_make_entryL   s    !$),,{--gw??ueFmW%%%eiikk7+++ooc#e*ooq!!!c#h-  !$$$c#i.!!1%%%c#l#$$a(((dkoq!!!!!r   c                 $   t          | j                  | j        _        d| j        _        | j                            d           | j                                         |                     | j        j	        
                                d           d S )Nr   r*   )r   r   r    rE   r@   r   setpatr7   rG   r1   r2   r!   s    r   test_create_entriesz(SearchDialogBaseTest.test_create_entries[   ss    !$),,7###""$$$dko))++W55555r   c                    d| j         _        t          | j                  | j         _        | j                                         \  }}|                     |d           |                     t          t          |                    d           | j                             d          \  }}|                     |d         d           d S )Nr    z<class 'tkinter.ttk.Frame'>	testlabelr4   )	r    r@   r   r   rE   
make_framer.   strtype)r"   rE   rL   s      r   test_make_framez$SearchDialogBaseTest.test_make_frameb   s    !$),,{--//u###T%[[))+HIII {--k::uv44444r   c                 j    t          | j                  | j        _        d| j        _         |            S )Nr   )r   r   r    rE   r@   )r"   meths     r   btn_test_setupz#SearchDialogBaseTest.btn_test_setupn   s*    !$),,tvvr   c                    | j         }dD ]}|j        |j        |j        |j        fD ]}|                    |           |                     | j        j                  \  }}t          ||
                                          D ]N\  }}|\  }}|                     |d         |           |                     |                                |           Od S )N)r   rB   r4   )r   revarcasevarwordvarwrapvarsetr[   r    r8   zippack_slavesr.   r2   )	r"   er0   varrE   optionsspecbuttonrL   s	            r   test_create_option_buttonsz/SearchDialogBaseTest.test_create_option_buttonss   s    K 	3 	3EAIqyA  !00K57 7NE7 #We.?.?.A.A B B 3 3f!
U  777  E22223	3 	3r   c                    dD ]}| j         j        }|                    |           |                     | j        j                  \  }}|                                }t          ||          D ]T\  }}|\  }}	|                     |d         |	           ||k    r(|                     |	                                |           Ud S )N)FTr4   )
r   backvarra   r[   r    r9   rc   rb   r.   r2   )
r"   r0   re   rE   othersbuttonsrg   rh   valrL   s
             r   test_create_other_buttonsz.SearchDialogBaseTest.test_create_other_buttons   s    " 	7 	7E+%CGGENNN //02 2ME6''))G #FG 4 4 7 7f!
U  777%<< $$SWWYY6667	7 	7r   c                 
   t          | j                  | j        _        t          | j        j                  | j        _        | j                            d| j        j                  }|                     |d         d           d S )NTestr4   )r   r   r    rE   buttonframemake_buttonr%   r.   )r"   btns     r   test_make_buttonz%SearchDialogBaseTest.test_make_button   si    !$),,"'(9":":k%%fdk.?@@Vf-----r   c                    t          | j                  | j        _        | j                                         d}| j        j                                        D ]}|d         dk    r|d         }|                     d|           d S )NrS   r4   Closecommandr%   )r   r   r    rE   r:   rr   winfo_childrenrG   )r"   closebuttoncommandchilds      r   test_create_command_buttonsz0SearchDialogBaseTest.test_create_command_buttons   s    !$),,**,,,[,;;== 	6 	6EV}''%*9%5"g122222r   N)__name__
__module____qualname__classmethodr   r   r#   r&   r5   r>   rN   rQ   rX   r[   ri   ro   ru   r|    r   r   r   r      s         [   [
O O O     C C C" " "6 6 6
5 
5 
5  

3 
3 
37 7 7. . .3 3 3 3 3r   r   __main__   )	verbosityexit)__doc__unittesttest.supportr   tkinterr   r   r   tkinter.ttkr   idlelibr   r   r	   r   idlelib.idle_test.mock_idler
   TestCaser   r}   mainr   r   r   <module>r      s         ! ! ! ! ! ! & & & & & & & & & &       & & & & & & % % % % % % , , , , , ,B3 B3 B3 B3 B38, B3 B3 B3J zHMAA&&&&&& r   