ó
Š]c           @   sÒ   d  d l  Z  d  d l m Z d  d l m Z m Z d  d l j Z d  d l	 j
 Z d  d l m Z d  d l m Z d d d „  ƒ  YZ
 d d d	 „  ƒ  YZ d
 e  j f d „  ƒ  YZ e d k rÎ e  j d d ƒ n  d S(   iÿÿÿÿN(   t   requires(   t   Tkt   Text(   t   Func(   t   Eventt   AutoCompleteWindowc           B   s   e  Z d  „  Z RS(   c           C   s   d  S(   N(    (    (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   complete   s    (   t   __name__t
   __module__R   (    (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyR   
   s   t   DummyEditwinc           B   s   e  Z d  „  Z RS(   c         C   s1   | |  _  | |  _ d |  _ d |  _ t |  _ d  S(   Ni   (   t   roott   textt   indentwidtht   tabwidtht   Truet   context_use_ps1(   t   selfR
   R   (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   __init__   s
    				(   R   R   R   (    (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyR	      s   t   AutoCompleteTestc           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   sD   t  d ƒ t ƒ  |  _ t |  j ƒ |  _ t |  j |  j ƒ |  _ d  S(   Nt   gui(   R    R   R
   R   R   R	   t   editor(   t   cls(    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt
   setUpClass   s    
c         C   s#   |  `  |  ` |  j j ƒ  |  ` d  S(   N(   R   R   R
   t   destroy(   R   (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   tearDownClass    s    c         C   s/   |  j  j j d d ƒ t j |  j  ƒ |  _ d  S(   Ns   1.0t   end(   R   R   t   deletet   act   AutoCompletet   autocomplete(   R   (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   setUp&   s    c         C   s   |  j  |  j j |  j ƒ d  S(   N(   t   assertEqualR   t   editwinR   (   R   (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt	   test_init*   s    c         C   s&   |  j  j ƒ  } |  j | t j ƒ d  S(   N(   R   t   _make_autocomplete_windowt   assertIsInstancet   acwR   (   R   t   testwin(    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   test_make_autocomplete_window-   s    c         C   s9   |  j  j ƒ  |  j  _ |  j  j ƒ  |  j |  j  j ƒ d  S(   N(   R   R"   t   autocompletewindowt   _remove_autocomplete_windowt   assertIsNone(   R   (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   test_remove_autocomplete_window1   s    c         C   sE   t  ƒ  } | |  j _ |  j j d ƒ |  j | j t t t f ƒ d  S(   Nt   event(   R   R   t   open_completionst   force_open_completions_eventR   t   argsR   t   False(   R   t   o_cs(    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt!   test_force_open_completions_event7   s    	c         C   sÓ   |  j  } |  j } |  j j } t ƒ  } | | _ | d ƒ | | j d  ƒ |  j j d d ƒ | d ƒ | | j t	 t	 t	 d f ƒ |  j j
 d d ƒ |  j j d d ƒ | d ƒ | | j t	 t	 t	 d f ƒ d  S(   NR+   s   1.0s   re.i   R   s   "./Lib/i   (   R   R   t   try_open_completions_eventR   t   _open_completions_laterR.   t   NoneR   t   insertR/   R   (   R   t   EqualR   t   trycompletionst   o_c_l(    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   test_try_open_completions_event>   s    				


c         C   sö   |  j  } |  j } t d t ƒ } |  j | j | ƒ ƒ | ` |  j j d d ƒ | |  j j | ƒ d ƒ | j	 ƒ  t
 ƒ  } | | _ | |  j j | ƒ d  ƒ | | j t t t f ƒ t | _ | |  j j | ƒ d ƒ | | j t t t f ƒ d  S(   Nt   mc_states   1.0s   re.t   break(   R   R   R   R   R)   t   autocomplete_eventR:   R   R5   R(   R   R,   R4   R.   R/   t   result(   R   R6   R   t   evR0   (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   test_autocomplete_eventT   s    		
			c         C   s   d  S(   N(    (   R   (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   test_open_completions_latern   s    c         C   s   d  S(   N(    (   R   (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   test_delayed_open_completionsr   s    c         C   s   d  S(   N(    (   R   (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   test_open_completionsx   s    c         C   s   d  S(   N(    (   R   (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   test_fetch_completions}   s    c         C   s   d  S(   N(    (   R   (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   test_get_entity…   s    (   R   R   t   classmethodR   R   R   R!   R&   R*   R1   R9   R?   R@   RA   RB   RC   RD   (    (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyR      s   											t   __main__t	   verbosityi   (    (    (   t   unittestt   test.test_supportR    t   TkinterR   R   t   idlelib.AutoCompleteR   R   t   idlelib.AutoCompleteWindowR   R$   t   idlelib.idle_test.mock_idleR   t   idlelib.idle_test.mock_tkR   R	   t   TestCaseR   R   t   main(    (    (    s4   lib/python2.7/idlelib/idle_test/test_autocomplete.pyt   <module>   s   	t