ó
Š]c           @   sª   d  Z  d d l Z d d l m Z d d l m Z 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(   s   Test idlelib.ParenMatch.iÿÿÿÿN(   t   requires(   t   Tkt   Text(   t
   ParenMatcht   Mockc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         O   s   t  |  _ d  S(   N(   t   Falset   called(   t   selft   argst   kwargs(    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt   __init__   s    c         O   s   t  |  _ d  S(   N(   t   TrueR   (   R   R   R	   (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt   __call__   s    c         O   s   t  |  _ d  S(   N(   R   R   (   R   R   R	   (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt
   reset_mock   s    c         O   s   d  S(   N(    (   R   R   R	   (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt   after   s    (   t   __name__t
   __module__R
   R   R   R   (    (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyR   
   s   			t   DummyEditwinc           B   s   e  Z d  „  Z RS(   c         C   s(   | |  _  d |  _ d |  _ t |  _ d  S(   Ni   (   t   textt   indentwidtht   tabwidthR   t   context_use_ps1(   R   R   (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyR
      s    			(   R   R   R
   (    (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyR      s   t   ParenMatchTestc           B   sS   e  Z e d  „  ƒ Z e d „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   c         C   sM   t  d ƒ t ƒ  |  _ t |  j ƒ |  _ t |  j ƒ |  _ t ƒ  |  j _ d  S(   Nt   gui(	   R    R   t   rootR   R   R   t   editwinR   t
   text_frame(   t   cls(    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt
   setUpClass!   s
    
c         C   s#   |  `  |  ` |  j j ƒ  |  ` d  S(   N(   R   R   R   t   destroy(   R   (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt   tearDownClass)   s    c         C   s   |  j  j d d ƒ d  S(   Ns   1.0t   end(   R   t   delete(   R   (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt   tearDown/   s    c         C   sí   |  j  } t |  j ƒ } | j d ƒ | j d d ƒ | j d ƒ |  j d | j ƒ  ƒ |  j | j	 d d ƒ d ƒ | j d d
 ƒ | j
 ƒ  |  j d | j ƒ  ƒ |  j | j	 d d ƒ d ƒ | j d ƒ |  j | j	 d d ƒ d ƒ d S(   s:   
        Test ParenMatch with 'expression' style.
        t
   expressiont   inserts   def foobar(a, bt   events   <<parenmatch-check-restore>>t   parenR   s   1.10s   1.15t   )s   1.16N(   s   1.10s   1.15(    (   s   1.10s   1.16(   R   R   R   t	   set_styleR#   t   flash_paren_eventt   assertInt
   event_infot   assertTupleEqualt   tag_prevranget   restore_eventt   assertNotInt   assertEqualt   paren_closed_event(   R   R   t   pm(    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt   test_paren_expression2   s    	
c         C   sÄ   |  j  } t |  j ƒ } | j d ƒ | j d d ƒ | j d ƒ |  j d | j ƒ  ƒ |  j | j	 d d ƒ d ƒ | j d d
 ƒ | j
 ƒ  |  j d | j ƒ  ƒ |  j | j	 d d ƒ d ƒ d S(   s7   
        Test ParenMatch with 'default' style.
        t   defaultR#   s   def foobar(a, bR$   s   <<parenmatch-check-restore>>R%   R   s   1.10s   1.11R&   N(   s   1.10s   1.11(    (   R   R   R   R'   R#   R(   R)   R*   R+   R,   R-   R.   R/   (   R   R   R1   (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt   test_paren_defaultI   s    	
c         C   s¤   |  j  } t |  j ƒ } | j d d ƒ |  j | j d ƒ ƒ | j d d ƒ |  j | j d ƒ ƒ |  j | j d ƒ ƒ | j d d ƒ |  j | j d ƒ ƒ d S(   s—   
        Test corner cases in flash_paren_event and paren_closed_event.

        These cases force conditional expression and alternate paths.
        R#   s   # this is a commen)R$   s   
defs	    a, *arg)N(   R   R   R   R#   t   assertIsNoneR0   R(   (   R   R   R1   (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt   test_paren_corner[   s    	c         C   sl   t  |  j ƒ } t ƒ  | _ | j d ƒ |  j | j j ƒ | j j ƒ  | j d ƒ |  j | j j ƒ d  S(   Ni    i   (	   R   R   R   R-   t   handle_restore_timert
   assertTrueR   R   t   assertFalse(   R   R1   (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt   test_handle_restore_timern   s    (
   R   R   t   classmethodR   R   R!   R2   R4   R6   R:   (    (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyR      s   				t   __main__t	   verbosityi   (    (    (   t   __doc__t   unittestt   test.test_supportR    t   TkinterR   R   t   idlelib.ParenMatchR   R   R   t   TestCaseR   R   t   main(    (    (    s2   lib/python2.7/idlelib/idle_test/test_parenmatch.pyt   <module>   s   Y