%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/trial/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/trial/test/__pycache__/erroneous.cpython-312.pyc

�

Ϫ�f���L�dZddlmZddlmZmZmZddlmZddl	mZm
Z
Gd�de�ZGd�d	e�Z
Gd
�d�ZGd�d
eej�ZGd�deej"�ZGd�d�ZGd�deej�ZGd�deej"�ZGd�d�ZGd�deej�ZGd�deej"�ZGd�dej�ZGd�dej"�ZGd �d!ej�Zed"d#�Gd$�d%ej��ZGd&�d'ej"�ZGd(�d)ej"�ZGd*�d+ej"�ZGd,�d-ej"�Z d.�Z!Gd/�d0ej�Z"y1)2aJ
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.

Some of these tests are also used by L{twisted.trial._dist.test}.
�)�skipIf)�defer�protocol�reactor)�
deferLater)�unittest�utilc��eZdZy)�FoolishErrorN��__name__�
__module__�__qualname__���>/usr/lib/python3/dist-packages/twisted/trial/test/erroneous.pyrr���rrc�&�eZdZdZdeddfd�Zd�Zy)�
LargeErrorzj
    An exception which has a string representation of at least a specified
    number of characters.
    �minSize�returnNc�<�tj|�||_y�N)�	Exception�__init__r)�selfrs  rrzLargeError.__init__!s�����4� ���rc�,�d|jz}d|�d�S)N�xzLargeError<I fail: �>)r)r�larges  r�__str__zLargeError.__str__%s���d�l�l�"��$�U�G�1�-�-r)r
rr�__doc__�intrr!rrrrrs���
�����.rrc��eZdZd�Zd�Zy)�FailureInSetUpMixinc��td��)NzI am a broken setUp method�r�rs r�setUpzFailureInSetUpMixin.setUp+s���7�8�8rc��yrrr(s r�	test_noopzFailureInSetUpMixin.test_noop.���rN)r
rrr)r+rrrr%r%*s��9�
rr%c��eZdZy)�SynchronousTestFailureInSetUpNrrrrr.r.2rrr.c��eZdZy)�AsynchronousTestFailureInSetUpNrrrrr0r06rrr0c��eZdZd�Zd�Zy)�FailureInTearDownMixinc��td��)NzI am a broken tearDown methodr'r(s r�tearDownzFailureInTearDownMixin.tearDown;s���:�;�;rc��yrrr(s rr+z FailureInTearDownMixin.test_noop>r,rN)r
rrr4r+rrrr2r2:s��<�
rr2c��eZdZy)� SynchronousTestFailureInTearDownNrrrrr7r7B���	rr7c��eZdZy)�!AsynchronousTestFailureInTearDownNrrrrr:r:Hrrr:c� �eZdZdZdZd�Zd�Zy)�FailureButTearDownRunsMixinz7
    A test fails, but its L{tearDown} still runs.
    Fc��d|_y�NT)�tornDownr(s rr4z$FailureButTearDownRunsMixin.tearDownSs	����
rc��td��)z$
        A test that fails.
        zI am a broken testr'r(s r�
test_failsz&FailureButTearDownRunsMixin.test_failsVs���/�0�0rN)r
rrr"r?r4rArrrr<r<Ls����H��1rr<c��eZdZy)�%SynchronousTestFailureButTearDownRunsNrrrrrCrC]r8rrCc��eZdZy)�&AsynchronousTestFailureButTearDownRunsNrrrrrErEcr8rrEc��eZdZd�Zd�Zd�Zy)�TestRegularFailc�&�|jd�y)N�I fail��failr(s r�	test_failzTestRegularFail.test_failjs���	�	�(�rc�$�|j�yr)�
subroutiner(s r�test_subfailzTestRegularFail.test_subfailms�����rc�&�|jd�y)Nz
I fail insiderJr(s rrNzTestRegularFail.subroutineps���	�	�/�"rN)r
rrrLrOrNrrrrGrGis����#rrGc�x�eZdZdZdZdejdfd�Zdejdfd�Zd
d�Z	d
d�Z
d
d	�Zy)�TestAsynchronousFailz?
    Test failures for L{unittest.TestCase} based classes.
    rIrNc�:�ttd|jd�S)zW
        A test which fails in the callback of the returned L{defer.Deferred}.
        rzI fail later�rrrKr(s rrLzTestAsynchronousFail.test_fail{s���'�1�d�i�i��@�@rc�F�ttd|jdddzz�S)zw
        A test which fails in the callback of the returned L{defer.Deferred}
        with a very long string.
        rzI fail later: r�rTr(s r�test_failGreaterThan64kz,TestAsynchronousFail.test_failGreaterThan64k�s#��
�'�1�d�i�i�1A�C�%�K�1O�P�Prc�,�t|j��)zA
        A test which raises an exception synchronously.
        )r�textr(s r�test_exceptionz#TestAsynchronousFail.test_exception�s����	�	�"�"rc��td��)zk
        A test which raises an exception with a long string representation
        synchronously.
        rV)rr(s r�test_exceptionGreaterThan64kz1TestAsynchronousFail.test_exceptionGreaterThan64k�s��
���rc��tddz��)z�
        A test which synchronously raises an exception with a long string
        representation including non-ascii content.
        u☃i�)rr(s r�#test_exceptionGreaterThan64kEncodedz8TestAsynchronousFail.test_exceptionGreaterThan64kEncoded�s���
��-�.�.r)rN)r
rrr"rYr�DeferredrLrWrZr\r^rrrrRrRtsK����D�A�5�>�>�$�/�A�Q�����)=�Q�#� �	/rrRc��eZdZdZdZd�Zy)�	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.
    Fc��d|_ddzy)zJ
        Set C{self.ran} to True and raise a C{ZeroDivisionError}
        T�rN)�ranr(s r�test_foozErrorTest.test_foo�s�����	�A�rN)r
rrr"rdrerrrrara�s����C�rraTzskipping this testc��eZdZy)�TestSkipTestCaseNrrrrrgrg�s��rrgc�P�eZdZdZd�Zd�Zejde��ge_y)�DelayedCallzsomething blew upc�,�t|j��r)�RuntimeError�hiddenExceptionMsgr(s r�gozDelayedCall.go�s���4�2�2�3�3rc��tjd|j�tjd�|j	d�y)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)r�	callLaterrm�iteraterKr(s r�testHiddenExceptionzDelayedCall.testHiddenException�s1��	���!�T�W�W�%�������	�	�C�Drz!reactor\.iterate cannot be used.*)�message�categoryN)	r
rrrlrmrqr	�suppress�DeprecationWarningrrrriri�s4��,��4�E�"	��
�
�8�CU�	
�$�� rric��eZdZd�Zy)�ReactorCleanupTestsc�6�d�}tjd|�y)Nc��td�y)Nzfoo!)�printrrr�_z8ReactorCleanupTests.test_leftoverPendingCalls.<locals>._�s	���&�Mrg��@)rro)rr{s  r�test_leftoverPendingCallsz-ReactorCleanupTests.test_leftoverPendingCalls�s��	�	���'�1�%rN)r
rrr|rrrrwrw�s��&rrwc��eZdZd�Zy)�SocketOpenTestc��tj�}tj|_tjd|�y)Nr)r�Factory�Protocolr�	listenTCP)r�fs  r�test_socketsLeftOpenz#SocketOpenTest.test_socketsLeftOpen�s-��������&�&��
����!�Q�rN)r
rrr�rrrr~r~�s�� rr~c��eZdZd�Zd�Zd�Zy)�TimingOutDeferredc��yrrr(s r�
test_alphazTimingOutDeferred.test_alpha�r,rc�<�d|_tj�}|Sr>)�methodCalledrr_)r�ds  r�test_deferredThatNeverFiresz-TimingOutDeferred.test_deferredThatNeverFires�s�� ����N�N����rc��yrrr(s r�
test_omegazTimingOutDeferred.test_omega�r,rN)r
rrr�r�r�rrrr�r��s��
��

rr�c��y)zci will raise an unexpected exception...
    ... *CAUSE THAT'S THE KINDA GUY I AM*

    >>> 1/0
    Nrr(s r�unexpectedExceptionr��s�rc�&�eZdZUdZdZeed<d�Zy)�EventuallyFailingTestCasez>
    A test suite that fails after it is run a few times.
    r�nc�p�|xjdz
c_|jdk\r|jd�yy)zK
        Run successfully a few times and then fail forever after.
        rc�zeventually failingN)r�rKr(s r�test_itz!EventuallyFailingTestCase.test_it�s.��	
���!����6�6�Q�;��I�I�*�+�rN)r
rrr"r�r#�__annotations__r�rrrr�r��s����A�s�J�,rr�N)#r"rr�twisted.internetrrr�twisted.internet.taskr�
twisted.trialr	rrrr%�SynchronousTestCaser.�TestCaser0r2r7r:r<rCrErGrRrargrirwr~r�r�r�rrr�<module>r�s���
��5�5�,�(�	�9�	�.��.�
�
�	�$7��9U�9U�	�	�%8�(�:K�:K�	�
�
�	��H�8�8�	�	�(>��@Q�@Q�	�1�1�"	���!=�!=�	�	���!2�!2�	�#�h�2�2�#�*/�8�,�,�*/�Z��,�,��"��"�#�	�x�3�3�	�$�	��(�#�#��:&�(�+�+�&� �X�&�&� �

��)�)�

��
,�� <� <�
,r

Zerion Mini Shell 1.0