mς
­fIc           @   sͺ   d  k  Z  d k l Z d   Z d e f d     YZ d e f d     YZ d  d  d  Z	 d   Z
 d	   Z d
 e  i f d     YZ d   Z e d j o e   n d  S(   N(   s   test_supportc             s     d   } | S(   Nc            s   |  i i    |  S(   N(   t   funct   __dict__t   updatet   kwds(   R    (   R   (    t1   /mit/python/lib/python2.4/test/test_decorators.pyt   decorate   s    (   R   (   R   R   (    (   R   R   t	   funcattrs   s    t   MiscDecoratorsc           B   s   t  Z e d    Z RS(   Nc            s     d   } | S(   Nc            s     |  i d <|  S(   Nt   author(   t   nameR    R   (   R    (   R	   (    R   R      s    (   R   (   R	   R   (    (   R	   R   R      s    (   t   __name__t
   __module__t   staticmethodR   (    (    (    R   R   
   s   t   DbcheckErrorc           B   s   t  Z d   Z RS(   Nc         C   s$   t  i |  d | | | | f  d  S(   Ns+   dbcheck %r failed (func=%s args=%s kwds=%s)(   t	   Exceptiont   __init__t   selft   exprstrR    t   argsR   (   R   R   R    R   R   (    (    R   R      s    (   R
   R   R   (    (    (    R   R      s   c            s       d   } | S(   s+   Decorator to implement debugging assertionsc            s5   t   d   i d         d   } | S(   Ns
   dbcheck-%st   evalc             s9   t      p t    |  |   n   |  |   S(   N(	   R   t   exprt   globalst   localsR   R   R    R   R   (   R   R   (   R    R   R   R   R   (    R   t   check   s    (   t   compileR   R    t	   func_nameR   R   (   R    R   R   (   R   R   R   (   R    R   R   R      s    N(   R   (   R   R   R   R   (    (   R   R   R   R   t   dbcheck   s     c            s     d   } | S(   s&   Decorator to count calls to a functionc            s2     i  d   <    d   }  | _ | S(   Ni    c             s      c d 7< |  |   S(   Ni   (   t   countsR   R    R   R   (   R   R   (   R   R   R    (    R   t   call-   s    (   R    R   R   R   (   R    R   R   (   R   (   R    R   R   R   *   s
    	
	N(   R   (   R   R   (    (   R   R   t
   countcalls(   s     c            s%   h      d   }   i | _ | S(   Nc             s\   y  |  SWnI t j
 o!   |    } |  |  <| Sn t j
 o   |    Sn Xd  S(   N(   t   savedR   t   KeyErrorR    t   rest	   TypeError(   R   R    (   R    R   (    R   R   8   s    
(   R   R   R    R   (   R    R   R   (    (   R    R   R   t   memoize6   s    
t   TestDecoratorsc           B   sb   t  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d	   Z
 d
   Z RS(   Nc         C   sI   d t  f d     Y} |  i | i   d  |  i |   i   d  d  S(   Nt   Cc           B   s   t  Z e d    Z RS(   Nc           C   s   d S(   Ni*   (    (    (    (    R   t   fooK   s    (   R
   R   R   R%   (    (    (    R   R$   J   s   i*   (   t   objectR$   R   t   assertEqualR%   (   R   R$   (    (    R   t   test_singleI   s    c         C   s&   t  d    } |  i t | d  d  S(   Nc         C   s   |  S(   N(   t   x(   R)   (    (    R   t
   notamethodQ   s    i   (   R   R*   R   t   assertRaisesR!   (   R   R*   (    (    R   t   test_staticmethod_functionP   s    c         C   sK   t    } | i d  d    } |  i |   d  |  i | i d  d  S(   Nt   Cleesec           C   s   d S(   Ni*   (    (    (    (    R   R%   X   s    i*   (   R   t
   decoratorsR   R%   R   R'   (   R   R%   R.   (    (    R   t   test_dottedV   s    	c         C   sό   d   } d } t d d d d	  } | | |   d
    } |  i |   d  |  i | i | | f  | d d d d d d d    } |  i |   d  |  i | i d t d d d d  f  | d d	  d    } |  i | i d h  f  d  S(   Nc             s      d   } | S(   Nc            s   t  |  d    f  |  S(   Nt   dbval(   t   setattrR    R   R   (   R    (   R   R   (    R   R   b   s    (   R   (   R   R   R   (    (   R   R   R   t   noteargsa   s    t   Nowt   ist   thet   timet   onei   t   twoi   c           C   s   d S(   Ni*   (    (    (    (    R   t   f1i   s    i*   t   terryt   gilliamt   erict   idlet   johnt   cleesec           C   s   d S(   NiT   (    (    (    (    R   t   f2n   s    iT   c           C   s   d  S(   N(    (    (    (    R   t   f3t   s    (   R3   R4   R5   R6   (   R:   R;   (   i   i   (
   R2   R   t   dictR   R9   R   R'   R0   R@   RA   (   R   R9   R@   R2   R   R   RA   (    (    R   t   test_argforms]   s    	$(c         C   sH   t  d  d    } |  i | d d  d  |  i t | d d   d  S(   Ns   args[1] is not Nonec         C   s   |  | S(   N(   t   at   b(   RD   RE   (    (    R   t   fy   s    i   i   i   (   R   RF   R   R'   R+   R   t   None(   R   RF   (    (    R   t   test_dbcheckx   s    c         C   s5  h  } t t |  d     } |  i | i d  |  i | t d d   |  i | d  d  |  i | d d  |  i | d  d  |  i | d d  |  i | d  d  |  i | d d  |  i | d	 g  d	 d	 g  |  i | d d  |  i | d	 g  d	 d	 g  |  i | d d  d  S(
   Nc         C   s   |  d S(   Ni   (   R)   (   R)   (    (    R   t   double   s    RI   i    i   i   i   i   i   i
   (   R   R"   R   RI   R   R'   R   RB   (   R   RI   R   (    (    R   t   test_memoize   s    c         C   sυ   xJ d d d g D]9 } t | d d  d | } |  i t t | d d  q W|  i t t d d d  d	   } t d
 d  d |  } xj d t
 f d
 t f d t f d t f g D]> \ } } d | } t | d d  } |  i | t | |  q― Wd  S(   Ns   1+2s   x[3]s   (1, 2)t   testexprt   execs   @%s
def f(): passt   tests   @f1 @f2
def f(): passc         C   s
   t   d  S(   N(   t   NotImplementedError(   R    (    (    R   t   unimp«   s    t   nullvalRO   t   undefs   nullval.attrs$   @%s
def f(): pass
assert f() is None(   R   R   t   codestrR   R+   t   SyntaxErrorRO   RB   RG   t   contextt	   NameErrorR!   t   AttributeErrorRN   t   exct   codeR   (   R   RW   RR   R   RX   RT   RO   (    (    R   t   test_errors   s     
	+ 
c         C   su   d t  f d     Y} |  i |   i   d  |  i | i i d  |  i | i i d  |  i | i i d  d  S(   NR$   c           B   s5   t  Z e d d d d  e d d  d     Z RS(   Nt   abci   t   xyzt   hahat   boohi*   c         C   s   d S(   Ni*   (    (   R   (    (    R   R%   Ή   s    (   R
   R   R   R%   (    (    (    R   R$   Έ   s   i*   i   R\   (   R&   R$   R   R'   R%   RZ   R[   R]   (   R   R$   (    (    R   t   test_double·   s
    c         C   sD   d   } | d  | d  d     } |  i |   d d  d  S(   Nc            s     d   } | S(   s   Decorator factory that returns a decorator that replaces the
            passed-in function with one that returns the value of 'num'c            s
     d   S(   Nc              s     S(   N(   t   num(    (   R_   (    R   t   <lambda>Θ   s    (    (   R    (   R_   (    R   t   decoΗ   s    N(   Ra   (   R_   Ra   (    (   R_   R   t   callnumΔ   s     i   i   c           C   s   d S(   Ni*   (    (    (    (    R   R%   Κ   s    s,   Application order of decorators is incorrect(   Rb   R%   R   R'   (   R   R%   Rb   (    (    R   t
   test_orderΑ   s    	!c   
         sS  g      d    d t f    d     Y} t | d d d g  \ } } } d d d	 d
 d d d d d d d d g } g    | i | i	  | i | i	  | i | i	  d      } |  i |   d  |  i   |  g    d   } | i | i	  | i | i	  | i | i	  |    } |  i |   d  |  i   |  d  S(   Nc            s$    i d       d   } | S(   Nt   makedecc            s    i d    |  S(   Nt   calldec(   t   actionst   appendt   tagR    (   R    (   Rh   Rf   (    R   R   β   s    (   Rf   Rg   Rh   R   (   Rh   R   (   Rf   (   Rh   R   t   make_decoratorΰ   s    t   NameLookupTracerc              s    t  Z d   Z    d   Z RS(   Nc         C   s   | |  _  d  S(   N(   t   indexR   (   R   Rk   (    (    R   R   θ   s    c            sx   | d j o d  } } n= | d j o d t |  i  } } n t p t d |    i
 d | |  i f  | S(   NRi   t   evalnamet   argt   evalargss   Unknown attrname %ss   %s%d(   t   fnameRi   t   opnameR    t   strR   Rk   t   Falset   AssertionErrorRf   Rg   (   R   Ro   R    Rp   (   Rf   Ri   (    R   t   __getattr__λ   s    (   R
   R   R   Rt   (    (   Rf   Ri   (    R   Rj   η   s   	i   i   i   t	   evalname1t	   evalargs1t   makedec1t	   evalname2t	   evalargs2t   makedec2t	   evalname3t	   evalargs3t   makedec3t   calldec3t   calldec2t   calldec1c           C   s   d S(   Ni*   (    (    (    (    R   R%   ύ   s    i*   c           C   s   d S(   Ni*   (    (    (    (    R   t   bar  s    (   Rf   Ri   R&   Rj   t   mapt   c1t   c2t   c3t   expected_actionsRm   R%   R   R'   R   (
   R   Rj   Rf   R   R   R   R   R   R%   Ri   (    (   Rf   Ri   R   t   test_eval_orderΠ   s    !*?	<(   R
   R   R(   R,   R/   RC   RH   RJ   RY   R^   Rc   R   (    (    (    R   R#   G   s   								
	c           C   s   t  i t  d  S(   N(   t   test_supportt   run_unittestR#   (    (    (    R   t	   test_main  s    t   __main__(   t   unittestRM   R   R   R&   R   R   R   RG   R   R   R"   t   TestCaseR#   R   R
   (
   R   R#   R   R   R   R   R   R   R   R"   (    (    R   t   ?   s   		
		Ζ	