U
    ª€lj  ã                   @   sF   d Z ddl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.
é    N)ÚitrialÚreporterÚrunnerÚunittest)Úmockdoctestc                   @   s^   e Zd ZdZddœdd„Zddœdd„Zejddœd	d
„Zde	ddœdd„Z
ddœdd„ZdS )ÚRunnersTestsz.
    Tests for Twisted's doctest support.
    N)Úreturnc                 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idPrefixÚtest© r   úC/tmp/pip-unpacked-wheel-aghyhbke/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_basicTrialIntegration)r   r   c                 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é   )Úcountr   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   r   r   r   r   r   Útest_expectedResults.   s    z!RunnersTests.test_expectedResultsc                 C   s&   t  ¡  t¡}|  |¡ |  |¡ dS )z9
        Doctests should be runnable repeatably.
        Nr   )r   r   r   r   r   Útest_repeatable5   s    
zRunnersTests.test_repeatable)r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   ÚpyunitZ	TestSuiter   Úintr   r    r   r   r   r   r      s   	r   )r$   r   r%   Ztwisted.trialr   r   r   Ztwisted.trial.testr   ZSynchronousTestCaser   r   r   r   r   Ú<module>   s   