ó
Š]c           @   s°   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 e j f d	 „  ƒ  YZ e d
 k r¬ e j d d d d ƒ n  d S(   s©   Unittests for idlelib/SearchDialogBase.py

Coverage: 99%. The only thing not covered is inconsequential --
testing skipping of suite when self.needwrapbutton is false.

iÿÿÿÿN(   t   requires(   t   Tkt   Toplevelt   Frame(   t   SearchEngine(   t   SearchDialogBase(   t   Funct   SearchDialogBaseTestc           B   s’   e  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 RS(   c         C   s   t  d ƒ t ƒ  |  _ d  S(   Nt   gui(   R    R   t   root(   t   cls(    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt
   setUpClass   s    
c         C   s   |  j  j ƒ  |  `  d  S(   N(   R	   t   destroy(   R
   (    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   tearDownClass    s    c         C   s:   t  j |  j ƒ |  _ t j d |  j d |  j ƒ |  _ d  S(   NR	   t   engine(   t   seR   R	   R   t   sdbR   t   dialog(   t   self(    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   setUp%   s    c         C   s   |  j  j ƒ  d  S(   N(   R   t   close(   R   (    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   tearDown)   s    c         C   s¤   d  |  j _ |  j j d ƒ |  j |  j j j ƒ  d ƒ |  j j ƒ  |  j |  j j j ƒ  d ƒ |  j j d d d ƒ|  j |  j j j	 ƒ  d ƒ |  j j ƒ  d  S(   Nt   textt   normalt	   withdrawnt   searchphraset   hello(
   t   NoneR   t   default_commandt   opent   assertEqualt   topt   stateR   t   entt   get(   R   (    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   test_open_and_close,   s    c         C   s±   t  ƒ  |  j _ t  ƒ  |  j _ t  ƒ  |  j _ t  ƒ  |  j _ d  |  j _ |  j j ƒ  |  j	 |  j j j
 ƒ |  j	 |  j j j
 ƒ |  j	 |  j j j
 ƒ |  j	 |  j j j
 ƒ d  S(   N(   R   R   t   create_entriest   create_option_buttonst   create_other_buttonst   create_command_buttonsR   R   t   create_widgetst
   assertTruet   called(   R   (    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   test_create_widgets;   s    c         C   së   |  j  } d |  j _ t |  j ƒ |  j _ |  j j d d ƒ \ } } | | d d ƒ |  j | j ƒ  d ƒ | j	 ƒ  } | t
 | d ƒ d ƒ | t
 | d ƒ d ƒ | t
 | d ƒ d ƒ | t
 | d	 ƒ d ƒ | |  j j d ƒ d  S(
   Ni    s   Test:R   R   t   rowt   columni   t   rowspant
   columnspan(   R   R   R,   R   R	   R   t
   make_entryt   assertInR"   t	   grid_infot   int(   R   t   equalt   entryt   labelt   egi(    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   test_make_entryI   s    	c         C   sI   d |  j  _ |  j j d ƒ |  j  j ƒ  |  j |  j  j j ƒ  d ƒ d  S(   Ni    R   (   R   R,   R   t   setpatR$   R1   R!   R"   (   R   (    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   test_create_entriesX   s    c         C   s–   d |  j  _ t |  j ƒ |  j  _ |  j  j ƒ  \ } } |  j | d ƒ |  j | t ƒ |  j  j d ƒ \ } } |  j | d d ƒ |  j | t ƒ d  S(   Ni    t    t	   testlabelR   (	   R   R,   R   R	   R   t
   make_frameR   t   assertIsInstanceR   (   R   t   frameR6   (    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   test_make_frame^   s    c         C   s(   t  |  j ƒ |  j _ d |  j _ | ƒ  S(   Ni    (   R   R	   R   R   R,   (   R   t   meth(    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   btn_test_setupi   s    c   	      C   s  |  j  } xø d D]ð } x3 | j | j | j | j f D] } | j | ƒ q5 W|  j |  j j ƒ \ } } x– t	 | | j
 ƒ  ƒ D] \ } } | \ } } |  j | d | ƒ |  j | j ƒ  | ƒ | d k rØ | j ƒ  n
 | j ƒ  |  j | j ƒ  d | ƒ q} Wq Wd  S(   Ni    i   R   (   i    i   (   R   t   revart   casevart   wordvart   wrapvart   setRB   R   R%   t   zipt   pack_slavesR   R"   t   deselectt   select(	   R   t   eR    t   varR?   t   optionst   spect   buttonR6   (    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   test_create_option_buttonsn   s    	%"
c   
      C   s  x	t  t f D]û } |  j j } | j | ƒ |  j |  j j ƒ \ } } | j ƒ  } x² t	 | | ƒ D]¡ \ } } | \ } }	 |  j
 | d |	 ƒ | | k rc |  j
 | j ƒ  | ƒ | | j ƒ  |  j
 | j ƒ  d | ƒ | d | j ƒ  |  j
 | j ƒ  | ƒ qc qc Wq Wd  S(   NR   i   (   t   Falset   TrueR   t   backvarRG   RB   R   R&   RI   RH   R   R"   RK   (
   R   R    RM   R?   t   otherst   buttonsRO   RP   t   valR6   (    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   test_create_other_buttons   s    c         C   s`   t  |  j ƒ |  j _ t |  j j ƒ |  j _ |  j j d |  j j ƒ } |  j | d d ƒ d  S(   Nt   TestR   (	   R   R	   R   R   R   t   buttonframet   make_buttonR   R   (   R   t   btn(    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   test_make_button’   s    c         C   sa   |  j  j ƒ  d } x7 |  j  j j ƒ  D]# } | d d k r& | d } q& q& W|  j d | ƒ d  S(   NR;   R   R   t   command(   R   R'   RZ   t   winfo_childrenR1   (   R   t   closebuttoncommandt   child(    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   test_create_command_buttons˜   s    (   t   __name__t
   __module__t   classmethodR   R   R   R   R#   R+   R8   R:   R@   RB   RQ   RX   R]   Rb   (    (    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyR      s   											t   __main__t	   verbosityi   t   exit(   t   __doc__t   unittestt   test.test_supportR    t   TkinterR   R   R   t   idlelibR   R   R   R   t   idlelib.idle_test.mock_idleR   t   TestCaseR   Rc   t   main(    (    (    s8   lib/python2.7/idlelib/idle_test/test_searchdialogbase.pyt   <module>   s   Š