ó
I()Qc           @   s¢   d  Z  d d l Z d d l Z d d l m Z m Z e Z d e j f d „  ƒ  YZ	 d  e	 f d „  ƒ  YZ d e
 f d „  ƒ  YZ d	 „  Z d
 e
 f d „  ƒ  YZ d S(   t	   TestSuiteiÿÿÿÿN(   t   caset   utilt   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(    (    s4   ../Django//lib/python/django/utils/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   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyt   __repr__   s    c         C   s,   t  | |  j ƒ s t St |  ƒ t | ƒ k S(   N(   t
   isinstanceR
   t   NotImplementedR   (   R   t   other(    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyt   __eq__   s    c         C   s   |  | k S(   N(    (   R   R   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyt   __ne__   s    c         C   s   t  |  j ƒ S(   N(   t   iterR   (   R   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyt   __iter__   s    c         C   s+   d } x |  D] } | | j  ƒ  7} q W| S(   Ni    (   t   countTestCases(   R   t   casest   test(    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR   "   s    c         C   su   t  | d ƒ s+ t d t | ƒ f ƒ ‚ n  t | t ƒ ra t | t j t f ƒ ra t d ƒ ‚ n  |  j	 j
 | ƒ d  S(   Nt   __call__s   %r is not callablesN   TestCases and TestSuites must be instantiated before passing them to addTest()(   t   hasattrt	   TypeErrort   reprR   t   typet
   issubclassR   t   TestCaseR    R   t   append(   R   R   (    (    s4   ../Django//lib/python/django/utils/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   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR   2   s    c         C   s,   x% |  D] } | j  r Pn  | | ƒ q W| S(   N(   t
   shouldStop(   R   t   resultR   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyt   run8   s
    	c         O   s   |  j  | | Ž  S(   N(   R#   (   R   t   argst   kwds(    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR   ?   s    c         C   s   x |  D] } | j  ƒ  q Wd S(   s7   Run the tests without collecting errors in a TestResultN(   t   debug(   R   R   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR&   B   s    (    N(   t   __name__t
   __module__t   __doc__R   R   R   R   t   Nonet   __hash__R   R   R   R   R#   R   R&   (    (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR   
   s   						
			c           B   sb   e  Z d  Z d „  Z d „  Z e 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.   |  j  | ƒ |  j d  | ƒ |  j | ƒ | S(   N(   t   _wrapped_runt   _tearDownPreviousClassR*   t   _handleModuleTearDown(   R   R"   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR#   S   s    c         C   s:   t  ƒ  } |  j | t ƒ |  j d | ƒ |  j | ƒ d S(   s7   Run the tests without collecting errors in a TestResultN(   t   _DebugResultR,   t   TrueR-   R*   R.   (   R   R&   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR&   Y   s    	c         C   sÙ   xÒ |  D]Ê } | j  r Pn  t | ƒ r’ |  j | | ƒ |  j | | ƒ |  j | | ƒ | j | _ t | j d t ƒ s t | d t ƒ r’ q q’ n  t	 | d ƒ r´ | j
 | | ƒ q | sÇ | | ƒ q | j ƒ  q Wd  S(   Nt   _classSetupFailedt   _moduleSetUpFailedR,   (   R!   t   _isnotsuiteR-   t   _handleModuleFixturet   _handleClassSetUpR
   t   _previousTestClasst   getattrt   FalseR   R,   R&   (   R   R"   R&   R   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR,   b   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û y | ƒ  Wqû t k
 r÷ } t | t	 ƒ r¿ ‚  n  t
 | _ t j | ƒ } d | } |  j | | | ƒ qû Xn  d  S(   NR6   t   __unittest_skip__t
   setUpClasss   setUpClass (%s)(   R7   R*   R
   R2   R8   R1   R   t	   ExceptionR   R/   R0   R   R	   t   _addClassOrModuleLevelException(	   R   R   R"   t   previousClasst   currentClassR:   t   et	   classNamet	   errorName(    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR5   x   s.    			
c         C   s4   d  } t | d d  ƒ } | d  k	 r0 | j } n  | S(   NR6   (   R*   R7   R(   (   R   R"   t   previousModuleR=   (    (    s4   ../Django//lib/python/django/utils/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ä y | ƒ  Wqä t k
 rà } t | t ƒ r· ‚  n  t | _ d | } |  j | | | ƒ qä Xn  d  S(   Nt   setUpModules   setUpModule (%s)(   RC   R
   R(   R.   R8   R2   t   syst   modulest   KeyErrorR7   R*   R;   R   R/   R0   R<   (	   R   R   R"   RB   t   currentModulet   moduleRD   R?   RA   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR4      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   _ErrorHolderR7   R*   R   R   t   SkipTestt   strt   addErrorRE   t   exc_info(   R   R"   t	   exceptionRA   t   errorRJ   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR<   ¶   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Æ y | ƒ  WqÆ t k
 rÂ } t | t	 ƒ r¢ ‚  n  d | } |  j
 | | | ƒ qÆ Xn  d  S(   Nt   tearDownModules   tearDownModule (%s)(   RC   R*   R2   RE   RF   RG   R7   R;   R   R/   R<   (   R   R"   RB   RI   RR   R?   RA   (    (    s4   ../Django//lib/python/django/utils/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ð y | ƒ  Wqð t k
 rì } t | t ƒ r½ ‚  n  t j | ƒ } d | } |  j	 | | | ƒ qð Xn  d  S(   NR6   R1   R2   R9   t   tearDownClasss   tearDownClass (%s)(
   R7   R*   R
   R8   R;   R   R/   R   R	   R<   (	   R   R   R"   R=   R>   RS   R?   R@   RA   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR-   Ô   s(    	
(   R'   R(   R)   R#   R&   R8   R,   R5   RC   R4   R<   R.   R-   (    (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR    H   s   								RK   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   RT   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR   ø   s    c         C   s   |  j  S(   N(   RT   (   R   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyt   idû   s    c         C   s   d  S(   N(   R*   (   R   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyt   shortDescriptionþ   s    c         C   s   d |  j  f S(   Ns   <ErrorHolder description=%r>(   RT   (   R   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR     s    c         C   s
   |  j  ƒ  S(   N(   RU   (   R   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyt   __str__  s    c         C   s   d  S(   N(    (   R   R"   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR#     s    c         C   s   |  j  | ƒ S(   N(   R#   (   R   R"   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR     s    c         C   s   d S(   Ni    (    (   R   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR     s    N(   R'   R(   R)   R*   t   failureExceptionR   RU   RV   R   RW   R#   R   R   (    (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyRK   ì   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   R0   R8   (   R   (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR3     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'   R(   R)   R*   R6   R8   R2   R!   (    (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyR/     s   (   R)   RE   t   unittestt   django.utils.unittestR   R   R0   t
   __unittestR    R   t   objectRK   R3   R/   (    (    (    s4   ../Django//lib/python/django/utils/unittest/suite.pyt   <module>   s   >¤&		