ó
[³XMc           @   sU   d  Z  d d l m Z m Z m Z m Z d d l m Z d e j f d „  ƒ  YZ	 d S(   s!   
Test twisted's doctest support.
iÿÿÿÿ(   t   itrialt   runnert   unittestt   reporter(   t   mockdoctestt   TestRunnersc           B   sP   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z d „  Z	 RS(	   s.   
    Tests for Twisted's doctest support.
    c         C   sX   t  j ƒ  } | j t ƒ } d } x0 | j D]% } |  j | t j | ƒ j ƒ  ƒ q+ Wd S(   sÁ   
        Check that the id() of the doctests' case object contains the FQPN of
        the actual tests. We need this because id() has weird behaviour w/
        doctest in Python 2.3.
        s&   twisted.trial.test.mockdoctest.CounterN(	   R   t
   TestLoadert   loadDoctestsR   t   _testst   assertInR    t	   ITestCaset   id(   t   selft   loadert   suitet   idPrefixt   test(    (    sC   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_doctest.pyt   test_id   s
    c         C   s   |  j  t d t d „  ƒ S(   sP   
        Return a L{runner.DocTestSuite} for the doctests in C{module}.
        s*   DocTestSuite is deprecated in Twisted 8.0.c           S   s   t  j t ƒ S(   N(   R   t   DocTestSuiteR   (    (    (    sC   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_doctest.pyt   <lambda>$   s    (   t   assertWarnst   DeprecationWarningt   __file__(   R   t   module(    (    sC   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_doctest.pyt   makeDocSuite   s    c         C   s)   |  j  t ƒ } |  j d | j ƒ  ƒ d S(   sQ   
        L{countTestCases} returns the number of doctests in the module.
        i   N(   R   R   t   assertEqualt   countTestCases(   R   R   (    (    sC   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_doctest.pyt   test_correctCount'   s    c         C   s5   t  j ƒ  } | j t ƒ } |  j d | j ƒ  ƒ d S(   sP   
        L{loadDoctests} loads all of the doctests in the given module.
        i   N(   R   R   R   R   R   R   (   R   R   R   (    (    sC   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_doctest.pyt   test_basicTrialIntegration/   s    c         C   sV   t  j ƒ  } | j | ƒ |  j d | j ƒ |  j d t | j ƒ t | j ƒ ƒ d S(   s4   
        Run C{suite} and check the result.
        i   i   N(   R   t
   TestResultt   runR   t	   successest   lent   errorst   failures(   R   R   t   result(    (    sC   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_doctest.pyt   _testRun8   s    i   c         C   s&   t  j ƒ  j t ƒ } |  j | ƒ d S(   sL   
        Trial can correctly run doctests with its xUnit test APIs.
        N(   R   R   R   R   R$   (   R   t   countR   (    (    sC   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_doctest.pyt   test_expectedResultsC   s    c         C   s3   t  j ƒ  j t ƒ } |  j | ƒ |  j | ƒ d S(   s9   
        Doctests should be runnable repeatably.
        N(   R   R   R   R   R$   (   R   R   (    (    sC   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_doctest.pyt   test_repeatableK   s    (
   t   __name__t
   __module__t   __doc__R   R   R   R   R$   R&   R'   (    (    (    sC   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_doctest.pyR      s   							N(
   R*   t   twisted.trialR    R   R   R   t   twisted.trial.testR   t   TestCaseR   (    (    (    sC   /usr/lib/python2.7/dist-packages/twisted/trial/test/test_doctest.pyt   <module>   s   "