ó
[³XMc           @   sI   d  d l  m Z d  d l m Z d  d l Z d e j f d     YZ d S(   i˙˙˙˙(   t   unittest(   t   errorNt   TestStringificationc        )   B   s  e  Z d  Z d e j f d e j d g f d e j d d g f d e j d d e j d	  f f d
 e j f d e j d d g f d e j f d e j d d g f d e j	 f d e j	 d g f d e j	 g  i d d 6f d e j	 d d g f d e j
 f d e j
 d g f d e j
 d d g f d e j f d e j f d e j f d e j f d e j f d e j f d e j f d e j f d e j f d  e j f d! e j d d g f d" e j f d# e j d d g f d$ e j f d% e j f d& e j d d g f d' e j f d( e j d5 g f d) e j f d* e j g  i d+ d, 6f d- e j g  i d. d/ 6f d0 e j f d1 e j f g& Z d2   Z d3   Z  d4   Z! RS(6   s;   Test that the exceptions have useful stringifications.
    s*   An error occurred binding to an interface.s/   An error occurred binding to an interface: foo.t   foos3   An error occurred binding to an interface: foo bar.t   bars"   Couldn't listen on eth0:4242: Foo.t   eth0i  t   Foos   Message is too long to send.s%   Message is too long to send: foo bar.s   DNS lookup failed.s   DNS lookup failed: foo bar.s#   An error occurred while connecting.s0   An error occurred while connecting: someOsError.t   someOsErrors(   An error occurred while connecting: foo.t   strings5   An error occurred while connecting: someOsError: foo.s   Couldn't bind.s   Couldn't bind: someOsError.s    Couldn't bind: someOsError: foo.s   Hostname couldn't be looked up.s   No route to host.s%   Connection was refused by other side.s   TCP connection timed out.s%   File used for UNIX socket is no good.s&   Service name given as port is unknown.s   User aborted connection.s'   User timeout caused connection failure.s   An SSL error occurred.s=   Connection to the other side was lost in a non-clean fashion.sF   Connection to the other side was lost in a non-clean fashion: foo bar.s   Connection was closed cleanly.s'   Connection was closed cleanly: foo bar.s   Uh.s(   Tried to cancel an already-called event.s1   Tried to cancel an already-called event: foo bar.s+   Tried to cancel an already-cancelled event.sO   A process has ended without apparent errors: process finished with exit code 0.sC   A process has ended with a probable error condition: process ended.sU   A process has ended with a probable error condition: process ended with exit code 42.i*   t   exitCodesT   A process has ended with a probable error condition: process ended by signal SIGBUS.t   SIGBUSt   signalsF   The Connector was not connecting when it was asked to stop connecting.s?   The Port was not listening when it was asked to stop listening.c         C   s   x |  j  D] } | d } | d } y | d } Wn t k
 rK d } n Xy | d } Wn t k
 rs i  } n X|  j t | | |    |  q
 Wd  S(   Ni    i   i   i   (    (   t   listOfTestst
   IndexErrort   failUnlessEqualt   str(   t   selft   entryt   outputt	   exceptiont   argst   kwargs(    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_error.pyt   testThemAll   s    



c         C   s    |  j  t t j t j   d S(   sW   
        L{error.ConnectionClosed} is a superclass of L{error.ConnectionLost}.
        N(   t
   assertTruet
   issubclassR   t   ConnectionLostt   ConnectionClosed(   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_error.pyt-   test_connectionLostSubclassOfConnectionClosed   s    c         C   s    |  j  t t j t j   d S(   sW   
        L{error.ConnectionClosed} is a superclass of L{error.ConnectionDone}.
        N(   R   R   R   t   ConnectionDoneR   (   R   (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_error.pyt-   test_connectionDoneSubclassOfConnectionClosed¤   s    N("   t   __name__t
   __module__t   __doc__R   t	   BindErrort   CannotListenErrort   sockett   MessageLengthErrort   DNSLookupErrort   ConnectErrort   ConnectBindErrort   UnknownHostErrort   NoRouteErrort   ConnectionRefusedErrort   TCPTimedOutErrort   BadFileErrort   ServiceNameUnknownErrort	   UserErrort   TimeoutErrort   SSLErrorR   R   t   ConnectionFdescWentAwayt   AlreadyCalledt   AlreadyCancelledt   ProcessDonet   Nonet   ProcessTerminatedt   NotConnectingErrort   NotListeningErrorR   R   R   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_error.pyR   	   sĴ   																								(   t   twisted.trialR    t   twisted.internetR   R#   t   TestCaseR   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/test/test_error.pyt   <module>   s   