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: //proc/self/root/lib/python3/dist-packages/twisted/trial/test/__pycache__/erroneous.cpython-38.pyc
U


W[��@s�dZddlmZmZddlmZmZddlmZm	Z	m
Z
Gdd�de�ZGdd�de
�ZGd	d
�d
eej�ZGdd�deej�ZGd
d�de
�ZGdd�deej�ZGdd�deej�ZGdd�de
�ZGdd�deej�ZGdd�deej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd �d ej�Zd!e_Gd"d#�d#ej�ZGd$d%�d%ej�ZGd&d'�d'ej�Z Gd(d)�d)ej�Z!d*d+�Z"d,S)-a
Definitions of test cases with various interesting error-related behaviors, to
be used by test modules to exercise different features of trial's test runner.

See the L{twisted.trial.test.test_tests} module docstring for details about how
this code is arranged.
�)�division�absolute_import)�unittest�util)�reactor�protocol�deferc@seZdZdS)�FoolishErrorN��__name__�
__module__�__qualname__�rr�>/usr/lib/python3/dist-packages/twisted/trial/test/erroneous.pyr	sr	c@seZdZdd�Zdd�ZdS)�FailureInSetUpMixincCstd��dS)NzI am a broken setUp method�r	��selfrrr�setUpszFailureInSetUpMixin.setUpcCsdS�Nrrrrr�	test_noopszFailureInSetUpMixin.test_noopN)rrr
rrrrrrrsrc@seZdZdS)�SynchronousTestFailureInSetUpNr
rrrrr!src@seZdZdS)�AsynchronousTestFailureInSetUpNr
rrrrr'src@seZdZdd�Zdd�ZdS)�FailureInTearDownMixincCstd��dS)NzI am a broken tearDown methodrrrrr�tearDown.szFailureInTearDownMixin.tearDowncCsdSrrrrrrr1sz FailureInTearDownMixin.test_noopN)rrr
rrrrrrr-src@seZdZdS)� SynchronousTestFailureInTearDownNr
rrrrr6src@seZdZdS)�!AsynchronousTestFailureInTearDownNr
rrrrr<src@s$eZdZdZdZdd�Zdd�ZdS)�FailureButTearDownRunsMixinz7
    A test fails, but its L{tearDown} still runs.
    FcCs
d|_dS�NT)�tornDownrrrrrHsz$FailureButTearDownRunsMixin.tearDowncCstd��dS)z$
        A test that fails.
        zI am a broken testNrrrrr�
test_failsLsz&FailureButTearDownRunsMixin.test_failsN)rrr
�__doc__rrr rrrrrBsrc@seZdZdS)�%SynchronousTestFailureButTearDownRunsNr
rrrrr"Tsr"c@seZdZdS)�&AsynchronousTestFailureButTearDownRunsNr
rrrrr#Zsr#c@s$eZdZdd�Zdd�Zdd�ZdS)�TestRegularFailcCs|�d�dS)N�I fail��failrrrr�	test_failbszTestRegularFail.test_failcCs|��dSr)�
subroutinerrrr�test_subfailfszTestRegularFail.test_subfailcCs|�d�dS)Nz
I fail insider&rrrrr)jszTestRegularFail.subroutineN)rrr
r(r*r)rrrrr$`sr$c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�TestAsynchronousFailz?
    Test failures for L{unittest.TestCase} based classes.
    cCs(t��}|�|j�t�d|jd�|S)zW
        A test which fails in the callback of the returned L{defer.Deferred}.
        rN)r�DeferredZaddCallback�_laterr�	callLater�callback�r�drrrr(tszTestAsynchronousFail.test_failcCs|�d�dS)NzI fail laterr&)r�resrrrr-~szTestAsynchronousFail._latercCstd��dS)zA
        A test which raises an exception synchronously.
        r%N)�	Exceptionrrrr�test_exception�sz#TestAsynchronousFail.test_exceptionN)rrr
r!r(r-r4rrrrr+os
r+c@seZdZdZdZdd�ZdS)�	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)zJ
        Set C{self.ran} to True and raise a C{ZeroDivisionError}
        T�rN)�ranrrrr�test_foo�szErrorTest.test_fooN)rrr
r!r7r8rrrrr5�sr5c@seZdZdS)�TestSkipTestCaseNr
rrrrr9�sr9zskipping this testc@s2eZdZdZdd�Zdd�Zejded�ge_dS)	�DelayedCallzsomething blew upcCst|j��dSr)�RuntimeError�hiddenExceptionMsgrrrr�go�szDelayedCall.gocCs&t�d|j�t�d�|�d�dS)a�
        What happens if an error is raised in a DelayedCall and an error is
        also raised in the test?

        L{test_reporter.ErrorReportingTests.testHiddenException} checks that
        both errors get reported.

        Note that this behaviour is deprecated. A B{real} test would return a
        Deferred that got triggered by the callLater. This would guarantee the
        delayed call error gets reported.
        rg{�G�z�?z/Deliberate failure to mask the hidden exceptionN)rr.r=Ziterater'rrrr�testHiddenException�s
zDelayedCall.testHiddenExceptionz!reactor\.iterate cannot be used.*)�message�categoryN)	rrr
r<r=r>r�suppress�DeprecationWarningrrrrr:�s�r:c@seZdZdd�ZdS)�ReactorCleanupTestscCsdd�}t�d|�dS)NcSstd�dS)Nzfoo!)�printrrrr�_�sz8ReactorCleanupTests.test_leftoverPendingCalls.<locals>._g��@)rr.)rrErrr�test_leftoverPendingCalls�sz-ReactorCleanupTests.test_leftoverPendingCallsN)rrr
rFrrrrrC�srCc@seZdZdd�ZdS)�SocketOpenTestcCs t��}tj|_t�d|�dS)Nr)rZFactoryZProtocolrZ	listenTCP)r�frrr�test_socketsLeftOpen�sz#SocketOpenTest.test_socketsLeftOpenN)rrr
rIrrrrrG�srGc@s$eZdZdd�Zdd�Zdd�ZdS)�TimingOutDeferredcCsdSrrrrrr�
test_alpha�szTimingOutDeferred.test_alphacCsd|_t��}|Sr)ZmethodCalledrr,r0rrr�test_deferredThatNeverFires�sz-TimingOutDeferred.test_deferredThatNeverFirescCsdSrrrrrr�
test_omega�szTimingOutDeferred.test_omegaN)rrr
rKrLrMrrrrrJ�srJcCsdS)zci will raise an unexpected exception...
    ... *CAUSE THAT'S THE KINDA GUY I AM*

    >>> 1/0
    Nrrrrr�unexpectedException�srNN)#r!Z
__future__rrZ
twisted.trialrrZtwisted.internetrrrr3r	�objectrZSynchronousTestCaserZTestCaserrrrrr"r#r$r+r5r9�skipr:rCrGrJrNrrrr�<module>sR	
�
�	
�
�
�
�