
[XMc           @   sO  d  Z  d d l Z d d l m Z d d l m Z d d l m Z d d l m	 Z	 d d l
 m Z d d l m Z d d	 l m Z m Z d d
 l m Z d e f d     YZ d e f d     YZ d e j f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d S(   s!   
Tests for L{twisted.trial.util}
iN(   t
   implements(   t   IProcessTransport(   t   defer(   t   DelayedCall(   t   TestCase(   t   util(   t   DirtyReactorAggregateErrort   _Janitor(   t   packagest
   TestMktempc           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   sK   |  j    } t j j |  j t j  d  } |  j | d d d g  d  S(   Nis   twisted.trial.test.test_utilR	   t	   test_name(   t   mktempt   ost   patht   dirnamet   splitt   sept   failUnlessEqual(   t   selft   namet   dirs(    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyR
      s    "c         C   s&   |  j    } |  j | |  j     d  S(   N(   R   t   failIfEqual(   R   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_unique   s    c         C   sT   |  j    } t j j |  } |  j t j j |   |  j t j j |   d  S(   N(   R   R   R   R   t
   failUnlesst   existst   failIf(   R   R   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_created#   s    c         C   s8   t  j j |  j    } |  j | j t  j     d  S(   N(   R   R   t   abspathR   R   t
   startswitht   getcwd(   R   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_location)   s    (   t   __name__t
   __module__R
   R   R   R   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyR	      s   			t   TestIntrospectionc           B   s   e  Z d    Z RS(   c         C   sd   d d  l  } t j | j j  } | j | g } x- t | |  D] \ } } |  j | |  q@ Wd  S(   Ni(   t   suppressionR   t   getPythonContainerst   TestSuppression2t   testSuppressModulet   zipR   (   R   R"   t   parentst   expectedt   at   b(    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_containers/   s    (   R   R    R+   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyR!   .   s   t   TestFindObjectc           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(
   s4   
    Tests for L{twisted.trial.util.findObject}
    c         C   sc   t  j d  |  j   } |  j t |  d  |  j | d d t  |  j | d d d  d S(   sH   
        Calling L{findObject} results in a deprecation warning
        t    i   i    t   categoryt   messagess   twisted.trial.util.findObject was deprecated in Twisted 10.1.0: Please use twisted.python.reflect.namedAny instead.N(   R   t
   findObjectt   flushWarningst   assertEqualst   lent   assertIdenticalt   DeprecationWarning(   R   t   warningsShown(    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_deprecation=   s    c         C   s5   t  j d  } d d  l } |  j | t | f  d  S(   Nt   packagei(   R   R0   R8   R   t   True(   R   t   package1t   package2(    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_importPackageK   s    c         C   s9   t  j d  } d d l m } |  j t | f |  d  S(   Ns   goodpackage.test_samplei(   t   test_sample(   R   R0   t   goodpackageR=   R   R9   (   R   t   test_sample2R=   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_importModuleP   s    c         C   s   |  j  t t j d  d  S(   Ns   package.test_bad_module(   t   failUnlessRaisest   ZeroDivisionErrorR   R0   (   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_importErrorU   s    	c         C   s   |  j  t t j d  d  S(   Ns   package2.test_module(   RA   t   ImportErrorR   R0   (   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_sophisticatedImportErrorY   s    	c         C   s!   |  j  t j d  d t  d  S(   Nt   doesntexisti    (   R   R   R0   t   False(   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_importNonexistentPackage]   s    c         C   s!   |  j  t j d  d t  d  S(   Ns   package.doesntexisti    (   R   R   R0   RG   (   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_findNonexistentModule`   s    c         C   s>   |  j  t j d  d t  |  j  t j d  d t  d  S(   Ns   goodpackage.test_sample.doesnti    s0   goodpackage.test_sample.AlphabetTest.doesntexist(   R   R   R0   RG   (   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_findNonexistentObjectc   s    c         C   s<   t  j d  } d d l m } |  j | t | j f  d  S(   Ns$   goodpackage.test_sample.AlphabetTesti(   R=   (   R   R0   R>   R=   R   R9   t   AlphabetTest(   R   t   alpha1R=   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_findObjectExisti   s    (   R   R    t   __doc__R7   R<   R@   RC   RE   RH   RI   RJ   RM   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyR,   8   s   								t   TestRunSequentiallyc           B   sh   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
 e _ RS(   s   
    Sometimes it is useful to be able to run an arbitrary list of callables,
    one after the other.

    When some of those callables can return Deferreds, things become complex.
    c         C   s&   t  j g   } | j |  j g   | S(   s   
        When asked to run an empty list of callables, runSequentially returns a
        successful Deferred that fires an empty list.
        (   R   t   _runSequentiallyt   addCallbackt   assertEqual(   R   t   d(    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_emptyListx   s    c         C   s8   t  j d   g  } | j |  j t j d f g  | S(   s   
        When given a callable that succeeds without returning a Deferred,
        include the return value in the results list, tagged with a SUCCESS
        flag.
        c           S   s   d  S(   N(   t   None(    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   <lambda>   s    N(   R   RP   RQ   RR   R   t   SUCCESSRU   (   R   RS   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_singleSynchronousSuccess   s    c            s7   t  j   f d   g  }   f d   } | j |  S(   s   
        When given a callable that raises an exception, include a Failure for
        that exception in the results list, tagged with a FAILURE flag.
        c              s     j  d  S(   Nt   foo(   t   fail(    (   R   (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV      s    c            sL   |  \ \ } } | j    j    j | j   d    j | t j  d  S(   NRY   (   t   trapt   failureExceptionRR   t   getErrorMessageR   t   FAILURE(   t   resultst   flagRZ   (   R   (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   check   s    (   R   RP   RQ   (   R   RS   Ra   (    (   R   s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_singleSynchronousFailure   s    c         C   s8   t  j d   g  } | j |  j t j d f g  | S(   s   
        When given a callable that returns a successful Deferred, include the
        result of the Deferred in the results list, tagged with a SUCCESS flag.
        c           S   s   t  j d   S(   N(   R   t   succeedRU   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV      s    N(   R   RP   RQ   RR   R   RW   RU   (   R   RS   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_singleAsynchronousSuccess   s    c            s1   t  j d   g  }   f d   } | j |  S(   s   
        When given a callable that returns a failing Deferred, include the
        failure the results list, tagged with a FAILURE flag.
        c           S   s   t  j t d   S(   NRY   (   R   RZ   t
   ValueError(    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV      s    c            sI   |  \ \ } } | j  t    j | j   d    j | t j  d  S(   NRY   (   R[   Re   RR   R]   R   R^   (   R_   R`   RZ   (   R   (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRa      s    (   R   RP   RQ   (   R   RS   Ra   (    (   R   s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_singleAsynchronousFailure   s    c            s   g    g      f d    t  j  f d    f d   g  } |  j   d g   d j d  |  j   d d g   d j d  | S(   sf   
        Check that the callables are called in the given order, one after the
        other.
        c            s*   t  j   }  j |     j |  | S(   N(   R   t   Deferredt   append(   t   valueRS   (   t	   deferredst   log(    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRh      s    c              s
     d  S(   NRY   (    (    (   Rh   (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV      s    c              s
     d  S(   Nt   bar(    (    (   Rh   (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV      s    RY   iRl   N(   R   RP   RR   t   callbackRU   (   R   RS   (    (   Rk   Rj   Rh   s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_callablesCalledInOrder   s    c            s=   t  j   f d   d   g  }   f d   } | j |  S(   s   
        If one of the callables raises an error, then runSequentially continues
        to run the remaining callables.
        c              s     j  d  S(   NRY   (   RZ   (    (   R   (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV      s    c           S   s   d S(   NRl   (    (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV      s    c            sx   |  \ \ } } \ } } | j    j    j | t j    j | j   d    j | t j    j | d  d  S(   NRY   Rl   (   R[   R\   RR   R   R^   R]   RW   (   R_   t   flag1RZ   t   flag2t   result(   R   (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRa      s    (   R   RP   RQ   (   R   RS   Ra   (    (   R   s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_continuesAfterError   s    !c            sC   t  j   f d   d   g d t }   f d   } | j |  S(   s   
        If the C{stopOnFirstError} option is passed to C{runSequentially}, then
        no further callables are called after the first exception is raised.
        c              s     j  d  S(   NRY   (   RZ   (    (   R   (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV      s    c           S   s   d S(   NRl   (    (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV      s    t   stopOnFirstErrorc            sL   |  \ \ } } | j    j    j | t j    j | j   d  d  S(   NRY   (   R[   R\   RR   R   R^   R]   (   R_   Ro   RZ   (   R   (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRa      s    (   R   RP   R9   RQ   (   R   RS   Ra   (    (   R   s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_stopOnFirstError   s    	c            sC   t  j   f d   d   g d t }   f d   } | j |  S(   s  
        If the C{stripFlags} option is passed to C{runSequentially} then the
        SUCCESS / FAILURE flags are stripped from the output. Instead, the
        Deferred fires a flat list of results containing only the results and
        failures.
        c              s     j  d  S(   NRY   (   RZ   (    (   R   (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV      s    c           S   s   d S(   NRl   (    (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV      s    t
   stripFlagsc            sF   |  \ } } | j    j    j | j   d    j | d  d  S(   NRY   Rl   (   R[   R\   RR   R]   (   R_   RZ   Rq   (   R   (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRa      s    (   R   RP   R9   RQ   (   R   RS   Ra   (    (   R   s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_stripFlags   s    	t   YAGNI(   R   R    RN   RT   RX   Rb   Rd   Rf   Rn   Rr   Rt   Rv   t   todo(    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRO   p   s   	
			
					t   DirtyReactorAggregateErrorTestc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   s6   
    Tests for the L{DirtyReactorAggregateError}.
    c         C   s,   t  d d g  } |  j t |  d  d S(   s5   
        Delayed calls are formatted nicely.
        t   FooRl   sh   Reactor was unclean.
DelayedCalls: (set twisted.internet.base.DelayedCall.debug = True to debug)
Foo
barN(   R   R2   t   str(   R   t   error(    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_formatDelayedCall  s    c         C   s/   t  g  d d g  } |  j t |  d  d S(   s3   
        Selectables are formatted nicely.
        s   selectable 1s   selectable 2s;   Reactor was unclean.
Selectables:
selectable 1
selectable 2N(   R   R2   R{   (   R   R|   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_formatSelectables  s    c         C   s5   t  d d g d d g  } |  j t |  d  d S(   sR   
        Both delayed calls and selectables can appear in the same error.
        t   bleckt   Boozot   Sel1t   Sel2s   Reactor was unclean.
DelayedCalls: (set twisted.internet.base.DelayedCall.debug = True to debug)
bleck
Boozo
Selectables:
Sel1
Sel2N(   R   R2   R{   (   R   R|   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt%   test_formatDelayedCallsAndSelectables   s    (   R   R    RN   R}   R~   R   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRy     s   		t   StubReactorc           B   s8   e  Z d  Z d d  Z d d  Z d   Z d   Z RS(   s~  
    A reactor stub which contains enough functionality to be used with the
    L{_Janitor}.

    @ivar iterations: A list of the arguments passed to L{iterate}.
    @ivar removeAllCalled: Number of times that L{removeAll} was called.
    @ivar selectables: The value that will be returned from L{removeAll}.
    @ivar delayedCalls: The value to return from L{getDelayedCalls}.
    c         C   s7   | |  _  g  |  _ d |  _ | s* g  } n  | |  _ d S(   s   
        @param delayedCalls: See L{StubReactor.delayedCalls}.
        @param selectables: See L{StubReactor.selectables}.
        i    N(   t   delayedCallst
   iterationst   removeAllCalledt   selectables(   R   R   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   __init__=  s    				c         C   s   |  j  j |  d S(   s/   
        Increment C{self.iterations}.
        N(   R   Rh   (   R   t   timeout(    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   iterateJ  s    c         C   s   |  j  S(   s.   
        Return C{self.delayedCalls}.
        (   R   (   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   getDelayedCallsQ  s    c         C   s   |  j  d 7_  |  j S(   sS   
        Increment C{self.removeAllCalled} and return C{self.selectables}.
        i   (   R   R   (   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt	   removeAllX  s    N(   R   R    RN   RU   R   R   R   R   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyR   2  s
   		t   StubErrorReporterc           B   s    e  Z d  Z d   Z d   Z RS(   s   
    A subset of L{twisted.trial.itrial.IReporter} which records L{addError}
    calls.

    @ivar errors: List of two-tuples of (test, error) which were passed to
        L{addError}.
    c         C   s   g  |  _  d  S(   N(   t   errors(   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyR   j  s    c         C   s   |  j  j | | f  d S(   s6   
        Record parameters in C{self.errors}.
        N(   R   Rh   (   R   t   testR|   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   addErrorn  s    (   R   R    RN   R   R   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyR   a  s   	t   JanitorTestsc           B   sq   e  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 RS(   s    
    Tests for L{_Janitor}!
    c         C   sH   t  g   } t d d d | } | j   |  j | j d d g  d S(   s  
        During pending-call cleanup, the reactor will be spun twice with an
        instant timeout. This is not a requirement, it is only a test for
        current behavior. Hopefully Trial will eventually not do this kind of
        reactor stuff.
        t   reactori    N(   R   R   RU   t   _cleanPendingR2   R   (   R   R   t   jan(    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_cleanPendingSpinsReactor{  s    
c         C   su   d   } g  } t  d | d i  | j d    } t | g  } t d d d | } | j   |  j | | g  d S(   sW   
        During pending-call cleanup, the janitor cancels pending timed calls.
        c           S   s   d S(   Nt   Lulz(    (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   func  s    i,  c         S   s   d  S(   N(   RU   (   t   x(    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV     s    R   N(    (   R   Rh   R   R   RU   R   R2   (   R   R   t	   cancelledt   delayedCallR   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_cleanPendingCancelsCalls  s    	
c      	   C   s   t  d d   d i  d   d   d d   } t |  } t | g  } t d d d | } | j   } |  j | | g  d S(	   sK  
        The Janitor produces string representations of delayed calls from the
        delayed call cleanup method. It gets the string representations
        *before* cancelling the calls; this is important because cancelling the
        call removes critical debugging information from the string
        representation.
        i,  c           S   s   d  S(   N(   RU   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV     s    c         S   s   d  S(   N(   RU   (   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV     s    t   secondsc           S   s   d S(   Ni    (    (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV     s    R   N(    (   R   R{   R   R   RU   R   R2   (   R   R   t   delayedCallStringR   R   t   strings(    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt*   test_cleanPendingReturnsDelayedCallStrings  s    c         C   sB   t  g   } t d d d | } | j   |  j | j d  d S(   sM   
        The Janitor will remove selectables during reactor cleanup.
        R   i   N(   R   R   RU   t   _cleanReactorR2   R   (   R   R   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt#   test_cleanReactorRemovesSelectables  s    
c         C   sj   d t  f d     Y} |   } t g  | g  } t d d d | } | j   |  j | j d g  d S(   sI   
        The Janitor will kill processes during reactor cleanup.
        t   StubProcessTransportc           B   s*   e  Z d  Z e e  d   Z d   Z RS(   s   
            A stub L{IProcessTransport} provider which records signals.
            @ivar signals: The signals passed to L{signalProcess}.
            c         S   s   g  |  _  d  S(   N(   t   signals(   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyR     s    c         S   s   |  j  j |  d S(   sF   
                Append C{signal} to C{self.signals}.
                N(   R   Rh   (   R   t   signal(    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   signalProcess  s    (   R   R    RN   R    R   R   R   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyR     s   
	R   t   KILLN(   t   objectR   R   RU   R   R2   R   (   R   R   t   ptR   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_cleanReactorKillsProcesses  s    	
c         C   s]   d t  f d     Y} t g  |   g  } t d d d | } |  j | j   d g  d S(   s   
        The Janitor returns string representations of the selectables that it
        cleaned up from the reactor cleanup method.
        t
   Selectablec           B   s   e  Z d  Z d   Z RS(   sl   
            A stub Selectable which only has an interesting string
            representation.
            c         S   s   d S(   Ns   (SELECTABLE!)(    (   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   __repr__  s    (   R   R    RN   R   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyR     s   R   s   (SELECTABLE!)N(   R   R   R   RU   R2   R   (   R   R   R   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt)   test_cleanReactorReturnsSelectableStrings  s    c         C   s]   t  g   } t   } t   } t | | d | } |  j | j    |  j | j g   d S(   s   
        The post-case cleanup method will return True and not call C{addError}
        on the result if there are no pending calls.
        R   N(   R   R   R   R   t
   assertTruet   postCaseCleanupR2   R   (   R   R   R   t   reporterR   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_postCaseCleanupNoErrors  s    		c      	   C   s   t  d d   d
 i  d   d   d d   } t |  } t | g g   } t   } t   } t | | d | } |  j | j    |  j t	 | j
  d  |  j | j
 d d j j | g  d	 S(   s   
        The post-case cleanup method will return False and call C{addError} on
        the result with a L{DirtyReactorAggregateError} Failure if there are
        pending calls.
        i,  c           S   s   d  S(   N(   RU   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV     s    c         S   s   d  S(   N(   RU   (   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV     s    R   c           S   s   d S(   Ni    (    (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV     s    R   i   i    N(    (   R   R{   R   R   R   R   t   assertFalseR   R2   R3   R   Ri   R   (   R   R   R   R   R   R   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_postCaseCleanupWithErrors  s    		c         C   sT   t  g   } t   } t   } t | | d | } | j   |  j | j g   d S(   s   
        The post-class cleanup method will not call C{addError} on the result
        if there are no pending calls or selectables.
        R   N(   R   R   R   R   t   postClassCleanupR2   R   (   R   R   R   R   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   test_postClassCleanupNoErrors  s    		
c      	   C   s   t  d d   d
 i  d   d   d d   } t |  } t | g g   } t   } t   } t | | d | } | j   |  j t | j	  d  |  j | j	 d d j
 j | g  d	 S(   s   
        The post-class cleanup method call C{addError} on the result with a
        L{DirtyReactorAggregateError} Failure if there are pending calls.
        i,  c           S   s   d  S(   N(   RU   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV     s    c         S   s   d  S(   N(   RU   (   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV     s    R   c           S   s   d S(   Ni    (    (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyRV     s    R   i   i    N(    (   R   R{   R   R   R   R   R   R2   R3   R   Ri   R   (   R   R   R   R   R   R   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt*   test_postClassCleanupWithPendingCallErrors  s    		
c         C   s   d } t  g  | g  } t   } t   } t | | d | } | j   |  j t | j  d  |  j | j d d j j	 t
 |  g  d S(   s   
        The post-class cleanup method call C{addError} on the result with a
        L{DirtyReactorAggregateError} Failure if there are selectables.
        s   SELECTABLE HERER   i   i    N(   R   R   R   R   R   R2   R3   R   Ri   R   t   repr(   R   t
   selectableR   R   R   R   (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt)   test_postClassCleanupWithSelectableErrors!  s    		
(   R   R    RN   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyR   v  s   				
						(   RN   R   t   zope.interfaceR    t   twisted.internet.interfacesR   t   twisted.internetR   t   twisted.internet.baseR   t   twisted.trial.unittestR   t   twisted.trialR   t   twisted.trial.utilR   R   t   twisted.trial.testR   R	   R!   t   SysPathManglingTestR,   RO   Ry   R   R   R   R   (    (    (    s@   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_util.pyt   <module>   s"   
81/