U
    
W[                     @   sT   d Z ddlmZmZ ddlm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
    )divisionabsolute_importN)	Attributec                   @   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   s   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__   s    zITestCase.__call__c                   C   s   dS )zJ
        Return the number of tests in this test case. Usually 1.
        Nr   r   r   r   r	   countTestCases   s    zITestCase.countTestCasesc                   C   s   dS )zk
        Return a unique identifier for the test, usually the fully-qualified
        Python name.
        Nr   r   r   r   r	   id%   s    zITestCase.idc                 C   s   dS )zj
        Run the test, storing the results in C{result}.

        @param result: A L{TestResult}.
        Nr   r   r   r   r	   run,   s    zITestCase.runc                   C   s   dS )z9
        Return a short description of the test.
        Nr   r   r   r   r	   shortDescription4   s    zITestCase.shortDescriptionN)__name__
__module____qualname____doc__zir   ZfailureExceptionr
   r   r   r   r   r   r   r   r	   r      s   r   c                   @   s   e Zd ZdZedZedZedZe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 Zdd Zdd Zd/ddZd0ddZd d! Zd"d# Zd$d% Zd&d' Zd(d) Zd*d+ Zd,d- ZdS )1	IReporterz6
    I report results from a run of a test suite.
    zIDeprecated in Twisted 8.0. The io-stream that this reporter will write toz'Either 'default', 'brief', or 'verbose'z7Additional string argument passed from the command linezZ
        A boolean indicating that this reporter would like the test run to stop.
        z\Deprecated in Twisted 8.0. A value which will occasionally be passed to the L{write} method.zd
        The number of tests that seem to have been run according to this
        reporter.
        c                 C   s   dS )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	   	startTestT   s    zIReporter.startTestc                 C   s   dS )z~
        Report the status of a single test method

        @param method: an object that is adaptable to ITestMethod
        Nr   r   r   r   r	   stopTest\   s    zIReporter.stopTestc                 C   s   dS )z
        Deprecated in Twisted 8.0.

        Suites which wish to appear in reporter output should call this
        before running their tests.
        Nr   namer   r   r	   
startSuited   s    zIReporter.startSuitec                 C   s   dS )z
        Deprecated in Twisted 8.0.

        Called at the end of a suite, if and only if that suite has called
        C{startSuite}.
        Nr   r   r   r   r	   endSuitem   s    zIReporter.endSuitec                 C   s   dS )z
        Deprecated in Twisted 8.0.

        Called when the reactor has been left in a 'dirty' state

        @param errs: a list of L{twisted.python.failure.Failure}s
        Nr   )Zerrsr   r   r	   cleanupErrorsv   s    zIReporter.cleanupErrorsTc                 C   s   dS )a  
        Deprecated in Twisted 8.0.

        Called when an error occurs in a setUp* or tearDown* method

        @param warn: indicates whether or not the reporter should emit a
                     warning about the error
        @type warn: Boolean
        @param printStatus: indicates whether or not the reporter should
                            print the name of the method and the status
                            message appropriate for the type of error
        @type printStatus: Boolean
        Nr   )ZuserMethwarnZprintStatusr   r   r	   upDownError   s    zIReporter.upDownErrorc                 C   s   dS )z*
        Record that test passed.
        Nr   )testr   r   r	   
addSuccess   s    zIReporter.addSuccessc                 C   s   dS )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	   addError   s    zIReporter.addErrorc                 C   s   dS )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   s    zIReporter.addFailureNc                 C   s   dS )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 error: L{failure.Failure}
        @param error: 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	   addExpectedFailure   s    zIReporter.addExpectedFailurec                 C   s   dS )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	   addUnexpectedSuccess   s    zIReporter.addUnexpectedSuccessc                 C   s   dS )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   s    zIReporter.addSkipc                   C   s   dS )zq
        Deprecated in Twisted 8.0, use L{done} instead.

        Present a summary of the test results.
        Nr   r   r   r   r	   printSummary   s    zIReporter.printSummaryc                   C   s   dS )z
        Deprecated in Twisted 8.0, use L{done} instead.

        Present the errors that have occurred during the test run. This method
        will be called after all tests have been run.
        Nr   r   r   r   r	   printErrors   s    zIReporter.printErrorsc                 C   s   dS )z
        Deprecated in Twisted 8.0, use L{done} instead.

        Display a string to the user, without appending a new line.
        Nr   stringr   r   r	   write   s    zIReporter.writec                 C   s   dS )z~
        Deprecated in Twisted 8.0, use L{done} instead.

        Display a string to the user, appending a new line.
        Nr   r-   r   r   r	   writeln   s    zIReporter.writelnc                   C   s   dS )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   s    zIReporter.wasSuccessfulc                   C   s   dS )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   s    zIReporter.done)TT)N)N)r   r   r   r   r   r   streamZtbformatargsZ
shouldStopZ	separatorZtestsRunr   r   r   r   r   r   r!   r#   r%   r'   r(   r*   r+   r,   r/   r0   r1   r2   r   r   r   r	   r   ;   sF   
		




	r   )r   Z
__future__r   r   Zzope.interfaceZ	interfacer   r   Z	Interfacer   r   r   r   r   r	   <module>   s
   +