ó
8Þ	Pc           @   s¦   d  Z  d d l Z d d l m Z d d l m Z e Z d „  Z d e f d „  ƒ  YZ	 d  e	 f d	 „  ƒ  YZ
 d
 e f d „  ƒ  YZ d „  Z d e f d „  ƒ  YZ d S(   t	   TestSuiteiÿÿÿÿNi   (   t   case(   t   utilc         C   s    t  |  | d „  ƒ } | ƒ  d  S(   Nc           S   s   d  S(   N(   t   None(    (    (    s$   /usr/lib/python2.7/unittest/suite.pyt   <lambda>   s    (   t   getattr(   t   parentt   attrt   func(    (    s$   /usr/lib/python2.7/unittest/suite.pyt   _call_if_exists   s    t   BaseTestSuitec           B   sz   e  Z d  Z d 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(   sN   A simple test suite that doesn't provide class or module shared fixtures.
    c         C   s   g  |  _  |  j | ƒ d  S(   N(   t   _testst   addTests(   t   selft   tests(    (    s$   /usr/lib/python2.7/unittest/suite.pyt   __init__   s    	c         C   s    d t  j |  j ƒ t |  ƒ f S(   Ns   <%s tests=%s>(   R   t   strclasst	   __class__t   list(   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyt   __repr__   s    c         C   s,   t  | |  j ƒ s t St |  ƒ t | ƒ k S(   N(   t
   isinstanceR   t   NotImplementedR   (   R   t   other(    (    s$   /usr/lib/python2.7/unittest/suite.pyt   __eq__   s    c         C   s   |  | k S(   N(    (   R   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyt   __ne__   s    c         C   s   t  |  j ƒ S(   N(   t   iterR   (   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyt   __iter__%   s    c         C   s+   d } x |  D] } | | j  ƒ  7} q W| S(   Ni    (   t   countTestCases(   R   t   casest   test(    (    s$   /usr/lib/python2.7/unittest/suite.pyR   (   s    c         C   sw   t  | d ƒ s- t d j t | ƒ ƒ ƒ ‚ n  t | t ƒ rc t | t j t	 f ƒ rc t d ƒ ‚ n  |  j
 j | ƒ d  S(   Nt   __call__s   {} is not callablesN   TestCases and TestSuites must be instantiated before passing them to addTest()(   t   hasattrt	   TypeErrort   formatt   reprR   t   typet
   issubclassR   t   TestCaseR    R   t   append(   R   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyt   addTest.   s    c         C   s@   t  | t ƒ r t d ƒ ‚ n  x | D] } |  j | ƒ q% Wd  S(   Ns0   tests must be an iterable of tests, not a string(   R   t
   basestringR    R'   (   R   R   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR   8   s    c         C   s,   x% |  D] } | j  r Pn  | | ƒ q W| S(   N(   t
   shouldStop(   R   t   resultR   (    (    s$   /usr/lib/python2.7/unittest/suite.pyt   run>   s
    	c         O   s   |  j  | | Ž  S(   N(   R+   (   R   t   argst   kwds(    (    s$   /usr/lib/python2.7/unittest/suite.pyR   E   s    c         C   s   x |  D] } | j  ƒ  q Wd S(   s7   Run the tests without collecting errors in a TestResultN(   t   debug(   R   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR.   H   s    (    N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   t   __hash__R   R   R'   R   R+   R   R.   (    (    (    s$   /usr/lib/python2.7/unittest/suite.pyR
      s   						
			c           B   sY   e  Z d  Z e d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z RS(	   s³  A test suite is a composite test consisting of a number of TestCases.

    For use, create an instance of TestSuite, then add test case instances.
    When all tests have been added, the suite can be passed to a test
    runner, such as TextTestRunner. It will run the individual test cases
    in the order in which they were added, aggregating the results. When
    subclassing, do not forget to call the base class constructor.
    c         C   s  t  } t | d t  ƒ t  k r. t | _ } n  x° |  D]¨ } | j rH Pn  t | ƒ rÀ |  j | | ƒ |  j | | ƒ |  j | | ƒ | j	 | _
 t | j	 d t  ƒ s5 t | d t  ƒ rÀ q5 qÀ n  | sÓ | | ƒ q5 | j ƒ  q5 W| r|  j d  | ƒ |  j | ƒ t  | _ n  | S(   Nt   _testRunEnteredt   _classSetupFailedt   _moduleSetUpFailed(   t   FalseR   t   TrueR3   R)   t   _isnotsuitet   _tearDownPreviousClasst   _handleModuleFixturet   _handleClassSetUpR   t   _previousTestClassR.   R   t   _handleModuleTearDown(   R   R*   R.   t   topLevelR   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR+   X   s,    		c         C   s   t  ƒ  } |  j | t ƒ d S(   s7   Run the tests without collecting errors in a TestResultN(   t   _DebugResultR+   R7   (   R   R.   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR.   v   s    	c   	      C   s!  t  | d d  ƒ } | j } | | k r+ d  S| j r8 d  St  | d t ƒ rN d  Sy t | _ Wn t k
 rn n Xt  | d d  ƒ } | d  k	 rt | d ƒ zo y | ƒ  Wn] t k
 r} t	 | t
 ƒ rÏ ‚  n  t | _ t j | ƒ } d | } |  j | | | ƒ n XWd  t | d ƒ Xn  d  S(   NR<   t   __unittest_skip__t
   setUpClasst   _setupStdouts   setUpClass (%s)t   _restoreStdout(   R   R   R   R5   R6   R4   R    R	   t	   ExceptionR   R?   R7   R   R   t   _addClassOrModuleLevelException(	   R   R   R*   t   previousClasst   currentClassRA   t   et	   classNamet	   errorName(    (    s$   /usr/lib/python2.7/unittest/suite.pyR;   }   s4    		 	
c         C   s4   d  } t | d d  ƒ } | d  k	 r0 | j } n  | S(   NR<   (   R   R   R0   (   R   R*   t   previousModuleRF   (    (    s$   /usr/lib/python2.7/unittest/suite.pyt   _get_previous_module   s
    c   	      C   s
  |  j  | ƒ } | j j } | | k r+ d  S|  j | ƒ t | _ y t j | } Wn t k
 rf d  SXt	 | d d  ƒ } | d  k	 rt | d ƒ z` y | ƒ  WnN t k
 rð } t | t ƒ rÇ ‚  n  t | _ d | } |  j | | | ƒ n XWd  t | d ƒ Xn  d  S(   Nt   setUpModuleRB   s   setUpModule (%s)RC   (   RL   R   R0   R=   R6   R5   t   syst   modulest   KeyErrorR   R   R	   RD   R   R?   R7   RE   (	   R   R   R*   RK   t   currentModulet   moduleRM   RH   RJ   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR:   ¥   s.    	 	
c         C   sl   t  | ƒ } t | d d  ƒ } | d  k	 rR t | t j ƒ rR | | t | ƒ ƒ n | j | t j	 ƒ  ƒ d  S(   Nt   addSkip(
   t   _ErrorHolderR   R   R   R   t   SkipTestt   strt   addErrorRN   t   exc_info(   R   R*   t	   exceptionRJ   t   errorRS   (    (    s$   /usr/lib/python2.7/unittest/suite.pyRE   À   s
    c         C   sì   |  j  | ƒ } | d  k r d  S| j r, d  Sy t j | } Wn t k
 rQ d  SXt | d d  ƒ } | d  k	 rè t | d ƒ zW y | ƒ  WnE t k
 rÒ } t	 | t
 ƒ r² ‚  n  d | } |  j | | | ƒ n XWd  t | d ƒ Xn  d  S(   Nt   tearDownModuleRB   s   tearDownModule (%s)RC   (   RL   R   R5   RN   RO   RP   R   R	   RD   R   R?   RE   (   R   R*   RK   RR   R[   RH   RJ   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR=   È   s*    	 
c   	      C   s  t  | d d  ƒ } | j } | | k r+ d  St  | d t ƒ rA d  St  | d t ƒ rW d  St  | d t ƒ rm d  St  | d d  ƒ } | d  k	 rt | d ƒ zf y | ƒ  WnT t k
 rü } t | t ƒ rÍ ‚  n  t j	 | ƒ } d | } |  j
 | | | ƒ n XWd  t | d ƒ Xn  d  S(	   NR<   R4   R5   R@   t   tearDownClassRB   s   tearDownClass (%s)RC   (   R   R   R   R6   R	   RD   R   R?   R   R   RE   (	   R   R   R*   RF   RG   R\   RH   RI   RJ   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR9   á   s.    	 
(   R/   R0   R1   R6   R+   R.   R;   RL   R:   RE   R=   R9   (    (    (    s$   /usr/lib/python2.7/unittest/suite.pyR    N   s   		 				RT   c           B   s\   e  Z d  Z d	 Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z RS(
   s¾   
    Placeholder for a TestCase inside a result. As far as a TestResult
    is concerned, this looks exactly like a unit test. Used to insert
    arbitrary errors into a test suite run.
    c         C   s   | |  _  d  S(   N(   t   description(   R   R]   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR     s    c         C   s   |  j  S(   N(   R]   (   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyt   id  s    c         C   s   d  S(   N(   R   (   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyt   shortDescription  s    c         C   s   d |  j  f S(   Ns   <ErrorHolder description=%r>(   R]   (   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR     s    c         C   s
   |  j  ƒ  S(   N(   R^   (   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyt   __str__  s    c         C   s   d  S(   N(    (   R   R*   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR+     s    c         C   s   |  j  | ƒ S(   N(   R+   (   R   R*   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR     s    c         C   s   d S(   Ni    (    (   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR     s    N(   R/   R0   R1   R   t   failureExceptionR   R^   R_   R   R`   R+   R   R   (    (    (    s$   /usr/lib/python2.7/unittest/suite.pyRT   ü   s   							c         C   s'   y t  |  ƒ Wn t k
 r" t SXt S(   s?   A crude way to tell apart testcases and suites with duck-typing(   R   R    R7   R6   (   R   (    (    s$   /usr/lib/python2.7/unittest/suite.pyR8   "  s
    R?   c           B   s    e  Z d  Z d Z e Z e Z RS(   sC   Used by the TestSuite to hold previous class when running in debug.N(   R/   R0   R1   R   R<   R6   R5   R)   (    (    (    s$   /usr/lib/python2.7/unittest/suite.pyR?   +  s   (   R1   RN   t    R   R   R7   t
   __unittestR	   t   objectR
   R    RT   R8   R?   (    (    (    s$   /usr/lib/python2.7/unittest/suite.pyt   <module>   s   	>®&		