o
    ¯b6  ã                   @   s8   d Z ddlmZ G dd„ dejƒZG dd„ dejƒZdS )z3
Interfaces for Trial.

Maintainer: Jonathan Lange
é    Nc                   @   sB   e Zd ZdZe d¡Zdd„ Zdd„ Zdd„ Z	d	d
„ Z
dd„ ZdS )Ú	ITestCasezU
    The interface that a test case must implement in order to be used in Trial.
    z7The exception class that is raised by failed assertionsc                 C   ó   dS )zQ
        Run the test. Should always do exactly the same thing as run().
        N© ©Úresultr   r   ú6/usr/lib/python3/dist-packages/twisted/trial/itrial.pyÚ__call__   ó    zITestCase.__call__c                   C   r   )zJ
        Return the number of tests in this test case. Usually 1.
        Nr   r   r   r   r   ÚcountTestCases   r	   zITestCase.countTestCasesc                   C   r   )zk
        Return a unique identifier for the test, usually the fully-qualified
        Python name.
        Nr   r   r   r   r   Úid!   r	   zITestCase.idc                 C   r   )zj
        Run the test, storing the results in C{result}.

        @param result: A L{TestResult}.
        Nr   r   r   r   r   Úrun'   r	   zITestCase.runc                   C   r   )z9
        Return a short description of the test.
        Nr   r   r   r   r   ÚshortDescription.   r	   zITestCase.shortDescriptionN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚziÚ	AttributeÚfailureExceptionr   r
   r   r   r   r   r   r   r   r      s    ÿr   c                   @   sx   e Zd ZdZe d¡Ze d¡Zdd„ Zdd„ Z	dd	„ Z
d
d„ Zdd„ Zddd„Zddd„Zdd„ Zdd„ Zdd„ ZdS )Ú	IReporterz6
    I report results from a run of a test suite.
    zHA boolean indicating that this reporter would like the test run to stop.zd
        The number of tests that seem to have been run according to this
        reporter.
        c                 C   r   )z‹
        Report the beginning of a run of a single test method.

        @param method: an object that is adaptable to ITestMethod
        Nr   ©Úmethodr   r   r   Ú	startTestC   r	   zIReporter.startTestc                 C   r   )z~
        Report the status of a single test method

        @param method: an object that is adaptable to ITestMethod
        Nr   r   r   r   r   ÚstopTestJ   r	   zIReporter.stopTestc                 C   r   )z*
        Record that test passed.
        Nr   )Útestr   r   r   Ú
addSuccessQ   r	   zIReporter.addSuccessc                 C   r   )aI  
        Record that a test has raised an unexpected exception.

        @param test: The test that has raised an error.
        @param error: The error that the test raised. It will either be a
            three-tuple in the style of C{sys.exc_info()} or a
            L{Failure<twisted.python.failure.Failure>} object.
        Nr   )r   Úerrorr   r   r   ÚaddErrorV   r	   zIReporter.addErrorc                 C   r   )aH  
        Record that a test has failed with the given failure.

        @param test: The test that has failed.
        @param failure: The failure that the test failed with. It will
            either be a three-tuple in the style of C{sys.exc_info()}
            or a L{Failure<twisted.python.failure.Failure>} object.
        Nr   )r   Úfailurer   r   r   Ú
addFailure`   r	   zIReporter.addFailureNc                 C   r   )aï  
        Record that the given test failed, and was expected to do so.

        In Twisted 15.5 and prior, C{todo} was a mandatory parameter.

        @type test: L{unittest.TestCase}
        @param test: The test which this is about.
        @type failure: L{failure.Failure}
        @param failure: The error which this test failed with.
        @type todo: L{unittest.Todo}
        @param todo: The reason for the test's TODO status. If L{None}, a
            generic reason is used.
        Nr   )r   r   Útodor   r   r   ÚaddExpectedFailurej   r	   zIReporter.addExpectedFailurec                 C   r   )a†  
        Record that the given test failed, and was expected to do so.

        In Twisted 15.5 and prior, C{todo} was a mandatory parameter.

        @type test: L{unittest.TestCase}
        @param test: The test which this is about.
        @type todo: L{unittest.Todo}
        @param todo: The reason for the test's TODO status. If L{None}, a
            generic reason is used.
        Nr   )r   r    r   r   r   ÚaddUnexpectedSuccessy   r	   zIReporter.addUnexpectedSuccessc                 C   r   )zô
        Record that a test has been skipped for the given reason.

        @param test: The test that has been skipped.
        @param reason: An object that the test case has specified as the reason
            for skipping the test.
        Nr   )r   Úreasonr   r   r   ÚaddSkip†   r	   zIReporter.addSkipc                   C   r   )zŠ
        Return a boolean indicating whether all test results that were reported
        to this reporter were successful or not.
        Nr   r   r   r   r   ÚwasSuccessful�   r	   zIReporter.wasSuccessfulc                   C   r   )a1  
        Called when the test run is complete.

        This gives the result object an opportunity to display a summary of
        information to the user. Once you have called C{done} on an
        L{IReporter} object, you should assume that the L{IReporter} object is
        no longer usable.
        Nr   r   r   r   r   Údone•   r	   zIReporter.done)N)r   r   r   r   r   r   Ú
shouldStopÚtestsRunr   r   r   r   r   r!   r"   r$   r%   r&   r   r   r   r   r   4   s$    ÿÿ



	r   )r   Úzope.interfaceÚ	interfacer   Ú	Interfacer   r   r   r   r   r   Ú<module>   s   &