HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/trial/test/__pycache__/test_pyunitcompat.cpython-38.pyc
U


W[��@s�ddlmZmZddlZddlZddlmZddlmZddl	m
Z
mZddlm
Z
mZddlZGdd�de
�ZGd	d
�d
e
�ZdS)�)�division�absolute_importN)�implementer)�Failure)�SynchronousTestCase�PyUnitResultAdapter)�	IReporter�	ITestCasec@s.eZdZGdd�dej�Zdd�Zdd�ZdS)�PyUnitTestTestsc@seZdZdd�ZdS)zPyUnitTestTests.PyUnitTestcCsdS�N���selfrr�F/usr/lib/python3/dist-packages/twisted/trial/test/test_pyunitcompat.py�	test_passsz$PyUnitTestTests.PyUnitTest.test_passN)�__name__�
__module__�__qualname__rrrrr�
PyUnitTestsrcCs|�d�|_t|j�|_dS)Nr)rZoriginalr	�testr
rrr�setUpszPyUnitTestTests.setUpcCs|�t|j�d|jf�dS)zW
        Tests must be callable in order to be used with Python's unittest.py.
        z%r is not callable.N)�
assertTrue�callablerr
rrr�
test_callables
�zPyUnitTestTests.test_callableN)rrr�pyunitZTestCaserrrrrrrr
sr
c@speZdZdZGdd�de�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�PyUnitResultTestsz�
    Tests to show that PyUnitResultAdapter wraps TestResult objects from the
    standard library 'unittest' module in such a way as to make them usable and
    useful from Trial.
    c@seZdZdZdZdd�ZdS)zPyUnitResultTests.ErrorTestz�
        A test case which has a L{test_foo} which will raise an error.

        @ivar ran: boolean indicating whether L{test_foo} has been run.
        FcCsd|_dddS)zR
            Set C{self.ran} to True and raise a C{ZeroDivisionError}
            T�rN��ranr
rrr�test_foo9sz$PyUnitResultTests.ErrorTest.test_fooN)rrr�__doc__rrrrrr�	ErrorTest1sr!cCsHtt�Gdd�dt��}|�d�}|�}|�|�|�|jdt�dS)z�
        The L{PyUnitResultAdapter} is only used when the result passed to
        C{run} does *not* provide L{IReporter}.
        c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)zXPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter.<locals>.StubReporterz�
            A reporter which records data about calls made to it.

            @ivar errors: Errors passed to L{addError}.
            @ivar failures: Failures passed to L{addFailure}.
            cSsg|_g|_dSr)�errors�failuresr
rrr�__init__OszaPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter.<locals>.StubReporter.__init__cSsdS�z-
                Do nothing.
                Nr�rrrrr�	startTestSszbPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter.<locals>.StubReporter.startTestcSsdSr%rr&rrr�stopTestXszaPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter.<locals>.StubReporter.stopTestcSs|j�|�dS)z3
                Record the error.
                N)r"�append)rr�errorrrr�addError]szaPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReporter.<locals>.StubReporter.addErrorN)rrrr r$r'r(r+rrrr�StubReporterFs
r,rrN)rr�objectr!�runZassertIsInstancer"r)rr,r�resultrrr�0test_dontUseAdapterWhenReporterProvidesIReporterAs

zBPyUnitResultTests.test_dontUseAdapterWhenReporterProvidesIReportercCsVGdd�dt�}|d�}t��}|�|�|�|j�|�d|j�|�|���dS)Nc@seZdZdZdd�ZdS)z3PyUnitResultTests.test_success.<locals>.SuccessTestFcSs
d|_dS�NTr��srrrrlsz<PyUnitResultTests.test_success.<locals>.SuccessTest.test_fooN�rrrrrrrrr�SuccessTestjsr5rr)	rr�
TestResultr.rr�assertEqual�testsRun�
wasSuccessful)rr5rr/rrr�test_successis
zPyUnitResultTests.test_successcCshGdd�dt�}|d�}t��}|�|�|�|j�|�d|j�|�dt|j	��|�
|���dS)Nc@seZdZdZdd�ZdS)z3PyUnitResultTests.test_failure.<locals>.FailureTestFcSsd|_|�d�dS)NTzboom!)rZfailr2rrrrysz<PyUnitResultTests.test_failure.<locals>.FailureTest.test_fooNr4rrrr�FailureTestwsr;rr)rrr6r.rrr7r8�lenr#�assertFalser9)rr;rr/rrr�test_failurevs
zPyUnitResultTests.test_failurecCsZ|�d�}t��}|�|�|�|j�|�d|j�|�dt|j	��|�
|���dS)Nrr)r!rr6r.rrr7r8r<r"r=r9)rrr/rrr�
test_error�s

zPyUnitResultTests.test_errorcCshGdd�dt�}|d�}t��}|�|�|�|j�|�d|j�|�dt|j	��|�|�
��dS)Nc@s eZdZdZdd�Zdd�ZdS)z4PyUnitResultTests.test_setUpError.<locals>.ErrorTestFcSsdddS�Nrrrr
rrrr�sz:PyUnitResultTests.test_setUpError.<locals>.ErrorTest.setUpcSs
d|_dSr1rr2rrrr�sz=PyUnitResultTests.test_setUpError.<locals>.ErrorTest.test_fooN)rrrrrrrrrrr!�sr!rr)rrr6r.r=rr7r8r<r"r9)rr!rr/rrr�test_setUpError�s
z!PyUnitResultTests.test_setUpErrorcCsrzddWn"tk
r.t��}t�}YnXt��}t|�}|�||�|�|j	ddd�
tj|���dS)z�
        Errors added through the L{PyUnitResultAdapter} have the same traceback
        information as if there were no adapter at all.
        rr�N)
�ZeroDivisionError�sys�exc_inforrr6rr+r7r"�join�	traceback�format_exception�rrE�fZpyresultr/rrr�test_tracebackFromFailure�s�z+PyUnitResultTests.test_tracebackFromFailurecCs�Gdd�dt�}|d�}t��}|�|�d�t�|jd��}d�|jdd�	�d	d
��}|�
|��|t|�d	����d	S)zG
        As test_tracebackFromFailure, but covering more code.
        c@seZdZdZdd�ZdS)z3PyUnitResultTests.test_traceback.<locals>.ErrorTestNcSs2zddWn tk
r,t��|_�YnXdSr@)rCrDrEr
rrrr�s

z<PyUnitResultTests.test_traceback.<locals>.ErrorTest.test_foo)rrrrErrrrrr!�sr!rrB��
rrN���)
rrr6r.rFrG�	format_tbrEr"�
splitlinesr7�stripr<)rr!rr/Zexpected_stackZobserved_stackrrr�test_traceback�s
	 
�z PyUnitResultTests.test_tracebackcCszzddWn"tk
r.t��}t�}YnX|��t��}t|�}|�||�|�	|j
ddd�tj
|���dS)z�
        Errors added through the L{PyUnitResultAdapter} have the same
        traceback information as if there were no adapter at all, even
        if the Failure that held the information has been cleaned.
        rrrBN)rCrDrErZcleanFailurerr6rr+r7r"rFrGrHrIrrr�test_tracebackFromCleanFailure�s�z0PyUnitResultTests.test_tracebackFromCleanFailurecCsBGdd�dt�}|d�}t��}|�|�|�|j|dfg�dS)zw
        Skips using trial's skipping functionality are reported as skips in
        the L{pyunit.TestResult}.
        c@seZdZdd�Zde_dS)z2PyUnitResultTests.test_trialSkip.<locals>.SkipTestcSsdddSr@rr
rrr�	test_skip�sz<PyUnitResultTests.test_trialSkip.<locals>.SkipTest.test_skip�Let's skip!N)rrrrT�skiprrrr�SkipTest�srWrTrUN�rrr6r.r7Zskipped�rrWrr/rrr�test_trialSkip�s

z PyUnitResultTests.test_trialSkipcCsBGdd�dt�}|d�}t��}|�|�|�|j|dfg�dS)zx
        Skips using pyunit's skipping functionality are reported as skips in
        the L{pyunit.TestResult}.
        c@seZdZe�d�dd��ZdS)z3PyUnitResultTests.test_pyunitSkip.<locals>.SkipTest�skippycSsdddSr@rr
rrrrT�sz=PyUnitResultTests.test_pyunitSkip.<locals>.SkipTest.test_skipN)rrrrrVrTrrrrrW�srWrTr[NrXrYrrr�test_pyunitSkip�s

z!PyUnitResultTests.test_pyunitSkipN)rrrr rr!r0r:r>r?rArKrRrSrZr\rrrrr(s(

r)Z
__future__rrrDrGZzope.interfacerZtwisted.python.failurerZtwisted.trial.unittestrrZtwisted.trial.itrialrr	Zunittestrr
rrrrr�<module>s