;
Ìâ"Ic               @   s  d  d l  Z  d  d l Z d  d l Z d  d l m Z Gd „  d e j ƒ Z Gd „  d ƒ Z Gd „  d e ƒ Z Gd	 „  d
 e j ƒ Z	 Gd „  d e	 ƒ Z
 Gd „  d e	 ƒ Z d „  Z d „  Z e e ƒ Z d d „ Z d „  Z d „  Z e d k o e ƒ  n d S(   i    N(   u   supportc             B   s2   |  Ee  Z d  „  Z d „  Z d „  Z d „  Z d S(   c             C   s   t  j d  ƒ d  S(   N(   u   sysu
   setprofileu   None(   u   self(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   setUp   s    c             C   s   t  j d  ƒ d  S(   N(   u   sysu
   setprofileu   None(   u   self(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   tearDown   s    c             C   s   t  j ƒ  d  k p t ‚ d  S(   N(   u   sysu
   getprofileu   Noneu   AssertionError(   u   self(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu
   test_empty   s    c             C   s4   d „  } t  j | ƒ t  j ƒ  | k p t ‚ d  S(   Nc              W   s   d  S(   N(    (   u   args(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   fn   s    (   u   sysu
   setprofileu
   getprofileu   AssertionError(   u   selfu   fn(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_setget   s    	N(   u   __name__u
   __module__u   setUpu   tearDownu
   test_emptyu   test_setget(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   TestGetProfile   s   
			u   TestGetProfilec             B   s5   |  Ee  Z d  „  Z d „  Z d d „ Z d „  Z d S(   c             C   s   g  |  _  g  |  _ d  S(   N(   u   framesu   events(   u   self(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   __init__   s    	c             C   s?   | d k p | d k p | d k o |  j  | | ƒ n d  S(   Nu   callu   returnu	   exception(   u	   add_event(   u   selfu   frameu   eventu   arg(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   callback   s    c             C   s   | d k o t j d ƒ } n y |  j j | ƒ } Wn3 t k
 o' t |  j ƒ } |  j j | ƒ Yn X|  j j | | t	 | ƒ f ƒ d S(   u   Add an event to the log.i   N(
   u   Noneu   sysu	   _getframeu   framesu   indexu
   ValueErroru   lenu   appendu   eventsu   ident(   u   selfu   eventu   frameu   frameno(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu	   add_event#   s    c                s>   t  |  j j ƒ t  t  ƒ g ‰  d |  _ ‡  f d †  |  j Dƒ S(   u   Remove calls to add_event().c                s0   g  } |  ]" } | d  ˆ  k o | | q
 q
 S(   i   (    (   u   .0u   _[1]u   item(   u
   disallowed(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu
   <listcomp>5   s    N(   u   identu	   add_eventu   __func__u   Noneu   framesu   events(   u   self(    (   u
   disallowedu3   /mit/python/lib/python3.0/test/test_profilehooks.pyu
   get_events0   s    	N(   u   __name__u
   __module__u   __init__u   callbacku   Noneu	   add_eventu
   get_events(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   HookWatcher   s   
		u   HookWatcherc             B   st   |  Ee  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z i e d 6e d 6e d 6e d	 6e d
 6e d 6Z d S(   c             C   s#   | |  _  g  |  _ t j |  ƒ d  S(   N(   u   testcaseu   stacku   HookWatcheru   __init__(   u   selfu   testcase(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   __init__9   s    		c             C   s   |  j  | |  | ƒ d  S(   N(   u   dispatch(   u   selfu   frameu   eventu   arg(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   callback>   s    c             C   s$   |  j  d | ƒ |  j j | ƒ d  S(   Nu   call(   u	   add_eventu   stacku   append(   u   selfu   frame(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu
   trace_callB   s    c             C   s!   |  j  d | ƒ |  j j ƒ  d  S(   Nu   return(   u	   add_eventu   stacku   pop(   u   selfu   frame(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   trace_returnF   s    c             C   s   |  j  j d ƒ d  S(   Nu2   the profiler should never receive exception events(   u   testcaseu   fail(   u   selfu   frame(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   trace_exceptionJ   s    	c             C   s   d  S(   N(    (   u   selfu   frame(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu
   trace_passN   s    u   callu	   exceptionu   returnu   c_callu   c_returnu   c_exceptionN(	   u   __name__u
   __module__u   __init__u   callbacku
   trace_callu   trace_returnu   trace_exceptionu
   trace_passu   dispatch(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   ProfileSimulator8   s   
						u   ProfileSimulatorc             B   s   |  Ee  Z d  „  Z d S(   c             C   sS   t  | |  j ƒ  ƒ } | | k o- |  j d t j | ƒ t j | ƒ f ƒ n d  S(   Nu'   Expected events:
%s
Received events:
%s(   u   capture_eventsu   new_watcheru   failu   pprintu   pformat(   u   selfu   callableu   expectedu   events(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   check_events\   s    	N(   u   __name__u
   __module__u   check_events(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   TestCaseBase[   s   
u   TestCaseBasec             B   sŒ   |  Ee  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 „  Z d „  Z d S(   c             C   s   t  ƒ  S(   N(   u   HookWatcher(   u   self(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   new_watcherd   s    c             C   sA   d „  } t  | ƒ } |  j | d d | f d d | f g ƒ d  S(   Nc             S   s   d  S(   N(    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   fh   s    i   u   callu   return(   u   identu   check_events(   u   selfu   fu   f_ident(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_simpleg   s    	c             C   sA   d „  } t  | ƒ } |  j | d d | f d d | f g ƒ d  S(   Nc             S   s   d d d  S(   Ni   i    (    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   fp   s    i   u   callu   return(   u   identu   check_events(   u   selfu   fu   f_ident(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_exceptiono   s    	c             C   sA   d „  } t  | ƒ } |  j | d d | f d d | f g ƒ d  S(   Nc             S   s   y d d Wn Yn Xd  S(   Ni   i    (    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   fx   s      i   u   callu   return(   u   identu   check_events(   u   selfu   fu   f_ident(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_caught_exceptionw   s    	c             C   sA   d „  } t  | ƒ } |  j | d d | f d d | f g ƒ d  S(   Nc             S   s   y d d Wn Yn Xd  S(   Ni   i    (    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   f   s      i   u   callu   return(   u   identu   check_events(   u   selfu   fu   f_ident(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_caught_nested_exception€   s    	c             C   sA   d „  } t  | ƒ } |  j | d d | f d d | f g ƒ d  S(   Nc             S   s   d d d  S(   Ni   i    (    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   fŠ   s    i   u   callu   return(   u   identu   check_events(   u   selfu   fu   f_ident(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_nested_exception‰   s    	c          
      sŒ   d „  ‰  ‡  f d †  } t  ˆ  ƒ } t  | ƒ } |  j | d d | f d d | f d d | f d d | f d d | f d d | f g ƒ d  S(   Nc             S   s   d d d  S(   Ni   i    (    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   f•   s    c                s6   y ˆ  |  ƒ Wn! y ˆ  |  ƒ Wn Yn XYn Xd  S(   N(    (   u   p(   u   f(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   g—   s      i   u   calli   u   returni   (   u   identu   check_events(   u   selfu   gu   f_identu   g_ident(    (   u   fu3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_exception_in_except_clause”   s    	c          	      s€   d „  ‰  ‡  f d †  } t  ˆ  ƒ } t  | ƒ } |  j | d d | f d d | f d d | f d d | f d d | f g ƒ d  S(   Nc             S   s   d d d  S(   Ni   i    (    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   f¨   s    c          	      s#   z ˆ  |  ƒ Wd  |  j  d ƒ Xd  S(   Nu   falling through(   u	   add_event(   u   p(   u   f(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   gª   s     i   u   calli   u   returnu   falling through(   u   identu   check_events(   u   selfu   gu   f_identu   g_ident(    (   u   fu3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_exception_propogation§   s    	c             C   sA   d „  } t  | ƒ } |  j | d d | f d d | f g ƒ d  S(   Nc             S   s#   y d d Wn d d Yn Xd  S(   Ni   i    (    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   f·   s      i   u   callu   return(   u   identu   check_events(   u   selfu   fu   f_ident(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_raise_twice¶   s    	c             C   sA   d „  } t  | ƒ } |  j | d d | f d d | f g ƒ d  S(   Nc             S   s   y d d Wn ‚  Yn Xd  S(   Ni   i    (    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   fÀ   s      i   u   callu   return(   u   identu   check_events(   u   selfu   fu   f_ident(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_raise_reraise¿   s    	c             C   sA   d „  } t  | ƒ } |  j | d d | f d d | f g ƒ d  S(   Nc             S   s   t  ƒ  ‚ d  S(   N(   u	   Exception(   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   fÉ   s    i   u   callu   return(   u   identu   check_events(   u   selfu   fu   f_ident(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu
   test_raiseÈ   s    	c                s  d „  ‰ ‡ f d †  ‰  ‡  f d †  ‰ ‡ f d †  ‰ ‡ f d †  } t  ˆ ƒ } t  ˆ  ƒ } t  ˆ ƒ } t  ˆ ƒ } t  | ƒ } |  j | d d | f d d | f d	 d | f d
 d | f d d | f d d | f d
 d | f d	 d | f d d | f d d | f g
 ƒ d  S(   Nc               S   s   d d d  S(   Ni   i    (    (    (    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   fÑ   s    c                  s   ˆ  ƒ  d  S(   N(    (    (   u   f(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   gÓ   s    c                  s   ˆ  ƒ  d  S(   N(    (    (   u   g(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   hÕ   s    c                  s   ˆ  ƒ  d  S(   N(    (    (   u   h(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   i×   s    c                s   ˆ  ƒ  d  S(   N(    (   u   p(   u   i(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   jÙ   s    i   u   calli   i   i   i   u   return(   u   identu   check_events(   u   selfu   ju   f_identu   g_identu   h_identu   i_identu   j_ident(    (   u   gu   fu   iu   hu3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_distant_exceptionÐ   s(    	c                s¤   d „  ‰  ‡  f d †  } t  ˆ  ƒ } t  | ƒ } |  j | d d | f d d | f d d | f d d | f d d | f d d | f d d | f d d | f g ƒ d  S(   Nc              s   s    x t  d ƒ D] }  |  Vq Wd  S(   Ni   (   u   range(   u   i(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   fí   s     c                s   x ˆ  ƒ  D] } q
 Wd  S(   N(    (   u   pu   i(   u   f(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   gð   s    
 i   u   calli   u   return(   u   identu   check_events(   u   selfu   gu   f_identu   g_ident(    (   u   fu3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_generatorì   s    	c                s¤   d „  ‰  ‡  f d †  } t  ˆ  ƒ } t  | ƒ } |  j | d d | f d d | f d d | f d d | f d d | f d d | f d d | f d d | f g ƒ d  S(   Nc              s   s&   x t  d ƒ D] }  |  Vq Wt ‚ d  S(   Ni   (   u   rangeu   StopIteration(   u   i(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   f  s     	c                s   x ˆ  ƒ  D] } q
 Wd  S(   N(    (   u   pu   i(   u   f(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   g  s    
 i   u   calli   u   return(   u   identu   check_events(   u   selfu   gu   f_identu   g_ident(    (   u   fu3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_stop_iteration  s    	N(   u   __name__u
   __module__u   new_watcheru   test_simpleu   test_exceptionu   test_caught_exceptionu   test_caught_nested_exceptionu   test_nested_exceptionu   test_exception_in_except_clauseu   test_exception_propogationu   test_raise_twiceu   test_raise_reraiseu
   test_raiseu   test_distant_exceptionu   test_generatoru   test_stop_iteration(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   ProfileHookTestCasec   s   
																	u   ProfileHookTestCasec             B   s;   |  Ee  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d S(   c             C   s
   t  |  ƒ S(   N(   u   ProfileSimulator(   u   self(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   new_watcher  s    c             C   sA   d „  } t  | ƒ } |  j | d d | f d d | f g ƒ d  S(   Nc             S   s   d  S(   N(    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   f  s    i   u   callu   return(   u   identu   check_events(   u   selfu   fu   f_ident(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_simple  s    	c             C   sA   d „  } t  | ƒ } |  j | d d | f d d | f g ƒ d  S(   Nc             S   s   d d d  S(   Ni   i    (    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   f&  s    i   u   callu   return(   u   identu   check_events(   u   selfu   fu   f_ident(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_basic_exception%  s    	c             C   sA   d „  } t  | ƒ } |  j | d d | f d d | f g ƒ d  S(   Nc             S   s   y d d Wn Yn Xd  S(   Ni   i    (    (   u   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   f.  s      i   u   callu   return(   u   identu   check_events(   u   selfu   fu   f_ident(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_caught_exception-  s    	c                s  d „  ‰ ‡ f d †  ‰  ‡  f d †  ‰ ‡ f d †  ‰ ‡ f d †  } t  ˆ ƒ } t  ˆ  ƒ } t  ˆ ƒ } t  ˆ ƒ } t  | ƒ } |  j | d d | f d d | f d	 d | f d
 d | f d d | f d d | f d
 d | f d	 d | f d d | f d d | f g
 ƒ d  S(   Nc               S   s   d d d  S(   Ni   i    (    (    (    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   f7  s    c                  s   ˆ  ƒ  d  S(   N(    (    (   u   f(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   g9  s    c                  s   ˆ  ƒ  d  S(   N(    (    (   u   g(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   h;  s    c                  s   ˆ  ƒ  d  S(   N(    (    (   u   h(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   i=  s    c                s   ˆ  ƒ  d  S(   N(    (   u   p(   u   i(    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   j?  s    i   u   calli   i   i   i   u   return(   u   identu   check_events(   u   selfu   ju   f_identu   g_identu   h_identu   i_identu   j_ident(    (   u   gu   fu   iu   hu3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   test_distant_exception6  s(    	N(   u   __name__u
   __module__u   new_watcheru   test_simpleu   test_basic_exceptionu   test_caught_exceptionu   test_distant_exception(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   ProfileSimulatorTestCase  s
   
					u   ProfileSimulatorTestCasec             C   s6   t  |  d ƒ o |  j } n
 |  j } | j | j f S(   Nu   f_code(   u   hasattru   f_codeu   __code__u   co_firstlinenou   co_name(   u   functionu   code(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   identS  s    	c             C   s   y |  | ƒ Wn Yn Xd  S(   N(    (   u   fu   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   protect[  s      c          	   C   sŒ   y t  j ƒ  Wn t k
 o Yn Xt j d ƒ ‚ | d  k o t ƒ  } n t  j | j ƒ t |  | ƒ t  j d  ƒ | j	 ƒ  d d … S(   Nu(   sys.setprofile() did not raise TypeErrori   iÿÿÿÿ(
   u   sysu
   setprofileu	   TypeErroru   supportu
   TestFailedu   Noneu   HookWatcheru   callbacku   protectu
   get_events(   u   callableu   p(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   capture_eventsb  s    	c             C   s#   d d  l  } | j  t |  ƒ ƒ d  S(   Ni    (   u   pprintu   capture_events(   u   callableu   pprint(    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   show_eventss  s    c               C   s   t  j t t t ƒ d  S(   N(   u   supportu   run_unittestu   TestGetProfileu   ProfileHookTestCaseu   ProfileSimulatorTestCase(    (    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu	   test_mainx  s    u   __main__(   u   pprintu   sysu   unittestu   testu   supportu   TestCaseu   TestGetProfileu   HookWatcheru   ProfileSimulatoru   TestCaseBaseu   ProfileHookTestCaseu   ProfileSimulatorTestCaseu   identu   protectu   protect_identu   Noneu   capture_eventsu   show_eventsu	   test_mainu   __name__(    (    (    u3   /mit/python/lib/python3.0/test/test_profilehooks.pyu   <module>   s"    #¶:				