U
    
W[æ  ã                   @   sN   d Z ddlmZmZ ddlmZmZmZmZ ddl	m
Z
 G dd„ dejƒZdS )z!
Test Twisted's doctest support.
é    )Úabsolute_importÚdivision)ÚitrialÚrunnerÚunittestÚreporter)Úmockdoctestc                   @   s:   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	d
„Zdd„ ZdS )ÚRunnersTestsz.
    Tests for Twisted's doctest support.
    c                 C   s<   t  ¡ }| t¡}d}|jD ]}|  |t |¡ ¡ ¡ qdS )zq
        Check that the id() of the doctests' case object contains the FQPN of
        the actual tests.
        z&twisted.trial.test.mockdoctest.CounterN)	r   Ú
TestLoaderÚloadDoctestsr   Z_testsZassertInr   Z	ITestCaseÚid)ÚselfÚloaderÚsuiteZidPrefixZtest© r   úA/usr/lib/python3/dist-packages/twisted/trial/test/test_doctest.pyÚtest_id   s
    

zRunnersTests.test_idc                 C   s&   t  ¡ }| t¡}|  d| ¡ ¡ dS )zP
        L{loadDoctests} loads all of the doctests in the given module.
        é   N)r   r
   r   r   ÚassertEqualZcountTestCases)r   r   r   r   r   r   Útest_basicTrialIntegration   s    
z'RunnersTests.test_basicTrialIntegrationc                 C   s6   t  ¡ }| |¡ |  d|j¡ |  dt|jƒ¡ dS )z4
        Run C{suite} and check the result.
        é   é   N)r   Z
TestResultÚrunr   Z	successesÚlenZfailures)r   r   Úresultr   r   r   Ú_testRun(   s    
zRunnersTests._testRuné   c                 C   s   t  ¡  t¡}|  |¡ dS )zL
        Trial can correctly run doctests with its xUnit test APIs.
        N©r   r
   r   r   r   )r   Úcountr   r   r   r   Útest_expectedResults2   s    z!RunnersTests.test_expectedResultsc                 C   s&   t  ¡  t¡}|  |¡ |  |¡ dS )z9
        Doctests should be runnable repeatably.
        Nr   )r   r   r   r   r   Útest_repeatable:   s    
zRunnersTests.test_repeatableN)r   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r    r   r   r   r   r	      s   	

r	   N)r$   Z
__future__r   r   Ztwisted.trialr   r   r   r   Ztwisted.trial.testr   ZSynchronousTestCaser	   r   r   r   r   Ú<module>   s   