§
    ÈtºfÁ  ã                   ó<  — d Z ddlmZ ddlmZmZmZ ddlmZ ddl	mZm
Z
  G d„ de¦  «        Z G d„ d	e¦  «        Z G d
„ d¦  «        Z G d„ deej        ¦  «        Z G d„ deej        ¦  «        Z G d„ d¦  «        Z G d„ deej        ¦  «        Z G d„ deej        ¦  «        Z G d„ d¦  «        Z G d„ deej        ¦  «        Z G d„ deej        ¦  «        Z G d„ dej        ¦  «        Z G d„ dej        ¦  «        Z G d „ d!ej        ¦  «        Z ed"d#¦  «         G d$„ d%ej        ¦  «        ¦   «         Z G d&„ d'ej        ¦  «        Z G d(„ d)ej        ¦  «        Z G d*„ d+ej        ¦  «        Z G d,„ d-ej        ¦  «        Z d.„ Z! G d/„ d0ej        ¦  «        Z"d1S )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                   ó   — e Zd ZdS )ÚFoolishErrorN©Ú__name__Ú
__module__Ú__qualname__© ó    ú[/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/trial/test/erroneous.pyr   r      ó   € € € € € Ø€Dr   r   c                   ó(   — e Zd ZdZdeddfd„Zd„ ZdS )Ú
LargeErrorzj
    An exception which has a string representation of at least a specified
    number of characters.
    ÚminSizeÚreturnNc                 óH   — t                                | ¦  «         || _        d S ©N)Ú	ExceptionÚ__init__r   )Úselfr   s     r   r   zLargeError.__init__!   s!   € Ý×Ò˜4Ñ Ô Ð ØˆŒˆˆr   c                 ó"   — d| j         z  }d|› d�S )NÚxzLargeError<I fail: ú>)r   )r   Úlarges     r   Ú__str__zLargeError.__str__%   s   € Ø�d”lÑ"ˆØ- UÐ-Ð-Ð-Ð-r   )r   r   r   Ú__doc__Úintr   r!   r   r   r   r   r      sO   € € € € € ðð ð
 ð ¨ð ð ð ð ð.ð .ð .ð .ð .r   r   c                   ó   — e Zd Zd„ Zd„ ZdS )ÚFailureInSetUpMixinc                 ó    — t          d¦  «        ‚)NzI am a broken setUp method©r   ©r   s    r   ÚsetUpzFailureInSetUpMixin.setUp+   s   € ÝÐ7Ñ8Ô8Ð8r   c                 ó   — d S r   r   r(   s    r   Ú	test_noopzFailureInSetUpMixin.test_noop.   ó   € Øˆr   N)r   r   r   r)   r+   r   r   r   r%   r%   *   s2   € € € € € ð9ð 9ð 9ðð ð ð ð r   r%   c                   ó   — e Zd ZdS )ÚSynchronousTestFailureInSetUpNr   r   r   r   r.   r.   2   r   r   r.   c                   ó   — e Zd ZdS )ÚAsynchronousTestFailureInSetUpNr   r   r   r   r0   r0   6   r   r   r0   c                   ó   — e Zd Zd„ Zd„ ZdS )ÚFailureInTearDownMixinc                 ó    — t          d¦  «        ‚)NzI am a broken tearDown methodr'   r(   s    r   ÚtearDownzFailureInTearDownMixin.tearDown;   s   € ÝÐ:Ñ;Ô;Ð;r   c                 ó   — d S r   r   r(   s    r   r+   z FailureInTearDownMixin.test_noop>   r,   r   N)r   r   r   r4   r+   r   r   r   r2   r2   :   s2   € € € € € ð<ð <ð <ðð ð ð ð r   r2   c                   ó   — e Zd ZdS )Ú SynchronousTestFailureInTearDownNr   r   r   r   r7   r7   B   ó   € € € € € ð 	€Dr   r7   c                   ó   — e Zd ZdS )Ú!AsynchronousTestFailureInTearDownNr   r   r   r   r:   r:   H   r   r   r:   c                   ó"   — e Zd ZdZdZd„ Zd„ ZdS )ÚFailureButTearDownRunsMixinz7
    A test fails, but its L{tearDown} still runs.
    Fc                 ó   — d| _         d S ©NT)ÚtornDownr(   s    r   r4   z$FailureButTearDownRunsMixin.tearDownS   s   € ØˆŒˆˆr   c                 ó    — t          d¦  «        ‚)z$
        A test that fails.
        zI am a broken testr'   r(   s    r   Ú
test_failsz&FailureButTearDownRunsMixin.test_failsV   s   € õ Ð/Ñ0Ô0Ð0r   N)r   r   r   r"   r?   r4   rA   r   r   r   r<   r<   L   sC   € € € € € ðð ð €Hðð ð ð1ð 1ð 1ð 1ð 1r   r<   c                   ó   — e Zd ZdS )Ú%SynchronousTestFailureButTearDownRunsNr   r   r   r   rC   rC   ]   r8   r   rC   c                   ó   — e Zd ZdS )Ú&AsynchronousTestFailureButTearDownRunsNr   r   r   r   rE   rE   c   r8   r   rE   c                   ó    — e Zd Zd„ Zd„ Zd„ ZdS )ÚTestRegularFailc                 ó0   — |                       d¦  «         d S )NúI fail©Úfailr(   s    r   Ú	test_failzTestRegularFail.test_failj   s   € Ø�	Š	�(ÑÔÐÐÐr   c                 ó.   — |                       ¦   «          d S r   )Ú
subroutiner(   s    r   Útest_subfailzTestRegularFail.test_subfailm   s   € Ø�ŠÑÔÐÐÐr   c                 ó0   — |                       d¦  «         d S )NzI fail insiderJ   r(   s    r   rN   zTestRegularFail.subroutinep   s   € Ø�	Š	�/Ñ"Ô"Ð"Ð"Ð"r   N)r   r   r   rL   rO   rN   r   r   r   rG   rG   i   sA   € € € € € ðð ð ðð ð ð#ð #ð #ð #ð #r   rG   c                   ór   — e Zd ZdZdZdej        d         fd„Zdej        d         fd„Zd
d„Z	d
d„Z
d
d	„ZdS )ÚTestAsynchronousFailz?
    Test failures for L{unittest.TestCase} based classes.
    rI   r   Nc                 ó:   — t          t          d| j        d¦  «        S )zW
        A test which fails in the callback of the returned L{defer.Deferred}.
        r   zI fail later©r   r   rK   r(   s    r   rL   zTestAsynchronousFail.test_fail{   s   € õ �' 1 d¤i°Ñ@Ô@Ð@r   c                 óF   — t          t          d| j        dddz  z   ¦  «        S )zw
        A test which fails in the callback of the returned L{defer.Deferred}
        with a very long string.
        r   zI fail later: r   é   rT   r(   s    r   Útest_failGreaterThan64kz,TestAsynchronousFail.test_failGreaterThan64k�   s$   € õ
 �' 1 d¤iÐ1AÀCÈ%ÁKÑ1OÑPÔPÐPr   c                 ó*   — t          | j        ¦  «        ‚)zA
        A test which raises an exception synchronously.
        )r   Útextr(   s    r   Útest_exceptionz#TestAsynchronousFail.test_exceptionˆ   s   € õ ˜œ	Ñ"Ô"Ð"r   c                 ó    — t          d¦  «        ‚)zk
        A test which raises an exception with a long string representation
        synchronously.
        rV   )r   r(   s    r   Útest_exceptionGreaterThan64kz1TestAsynchronousFail.test_exceptionGreaterThan64kŽ   s   € õ
 ˜ÑÔÐr   c                 ó&   — t          ddz  ¦  «        ‚)z‡
        A test which synchronously raises an exception with a long string
        representation including non-ascii content.
        u   â˜ƒi €  )r   r(   s    r   Ú#test_exceptionGreaterThan64kEncodedz8TestAsynchronousFail.test_exceptionGreaterThan64kEncoded•   s   € õ ˜¨Ñ-Ñ.Ô.Ð.r   )r   N)r   r   r   r"   rY   r   ÚDeferredrL   rW   rZ   r\   r^   r   r   r   rR   rR   t   s¯   € € € € € ðð ð €DðA˜5œ>¨$Ô/ð Að Að Að AðQ¨¬¸Ô)=ð Qð Qð Qð Qð#ð #ð #ð #ð ð  ð  ð  ð	/ð 	/ð 	/ð 	/ð 	/ð 	/r   rR   c                   ó   — e Zd ZdZdZd„ ZdS )Ú	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| _         ddz   dS )zJ
        Set C{self.ran} to True and raise a C{ZeroDivisionError}
        Té   r   N)Úranr(   s    r   Útest_foozErrorTest.test_fooª   s   € ð ˆŒØ	ˆA‰ˆˆˆr   N)r   r   r   r"   rd   re   r   r   r   ra   ra   ¡   s4   € € € € € ðð ð €Cðð ð ð ð r   ra   Tzskipping this testc                   ó   — e Zd ZdS )ÚTestSkipTestCaseNr   r   r   r   rg   rg   ²   s   € € € € € à€Dr   rg   c                   óN   — e Zd ZdZd„ Zd„ Z ej        de¬¦  «        ge_        dS )ÚDelayedCallzsomething blew upc                 ó*   — t          | j        ¦  «        ‚r   )ÚRuntimeErrorÚhiddenExceptionMsgr(   s    r   ÚgozDelayedCall.goº   s   € Ý˜4Ô2Ñ3Ô3Ð3r   c                 óŒ   — t          j        d| j        ¦  «         t          j        d¦  «         |                      d¦  «         dS )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.
        r   g{®Gáz„?z/Deliberate failure to mask the hidden exceptionN)r   Ú	callLaterrm   ÚiteraterK   r(   s    r   ÚtestHiddenExceptionzDelayedCall.testHiddenException½   sB   € õ 	Ô˜!˜TœWÑ%Ô%Ð%ÝŒ˜ÑÔÐØ�	Š	ÐCÑDÔDÐDÐDÐDr   z!reactor\.iterate cannot be used.*)ÚmessageÚcategoryN)	r   r   r   rl   rm   rq   r	   ÚsuppressÚDeprecationWarningr   r   r   ri   ri   ·   s`   € € € € € Ø,Ðð4ð 4ð 4ðEð Eð Eð" 	ˆŒØ8ÐCUð	
ñ 	
ô 	
ð$ÐÔ Ð Ð r   ri   c                   ó   — e Zd Zd„ ZdS )ÚReactorCleanupTestsc                 ó6   — d„ }t          j        d|¦  «         d S )Nc                  ó$   — t          d¦  «         d S )Nzfoo!)Úprintr   r   r   Ú_z8ReactorCleanupTests.test_leftoverPendingCalls.<locals>._Ö   s   € Ý�&‰MŒMˆMˆMˆMr   g     ˆÃ@)r   ro   )r   r{   s     r   Útest_leftoverPendingCallsz-ReactorCleanupTests.test_leftoverPendingCallsÕ   s,   € ð	ð 	ð 	õ 	Ô˜' 1Ñ%Ô%Ð%Ð%Ð%r   N)r   r   r   r|   r   r   r   rw   rw   Ô   s#   € € € € € ð&ð &ð &ð &ð &r   rw   c                   ó   — e Zd Zd„ ZdS )ÚSocketOpenTestc                 óx   — t          j        ¦   «         }t           j        |_         t          j        d|¦  «         d S )Nr   )r   ÚFactoryÚProtocolr   Ú	listenTCP)r   Úfs     r   Útest_socketsLeftOpenz#SocketOpenTest.test_socketsLeftOpenÝ   s3   € ÝÔÑÔˆÝÔ&ˆŒ
ÝÔ˜!˜QÑÔÐÐÐr   N)r   r   r   r„   r   r   r   r~   r~   Ü   s#   € € € € € ð ð  ð  ð  ð  r   r~   c                   ó    — e Zd Zd„ Zd„ Zd„ ZdS )ÚTimingOutDeferredc                 ó   — d S r   r   r(   s    r   Ú
test_alphazTimingOutDeferred.test_alphaä   r,   r   c                 ó:   — d| _         t          j        ¦   «         }|S r>   )ÚmethodCalledr   r_   )r   Úds     r   Útest_deferredThatNeverFiresz-TimingOutDeferred.test_deferredThatNeverFiresç   s   € Ø ˆÔÝŒNÑÔˆØˆr   c                 ó   — d S r   r   r(   s    r   Ú
test_omegazTimingOutDeferred.test_omegaì   r,   r   N)r   r   r   rˆ   rŒ   rŽ   r   r   r   r†   r†   ã   sA   € € € € € ðð ð ðð ð ð
ð ð ð ð r   r†   c                 ó   — dS )zci will raise an unexpected exception...
    ... *CAUSE THAT'S THE KINDA GUY I AM*

    >>> 1/0
    Nr   r(   s    r   ÚunexpectedExceptionr�   ð   s   € € € r   c                   ó(   — e Zd ZU dZdZeed<   d„ ZdS )ÚEventuallyFailingTestCasez>
    A test suite that fails after it is run a few times.
    r   Únc                 ój   — | xj         dz  c_         | j         dk    r|                      d¦  «         dS dS )zK
        Run successfully a few times and then fail forever after.
        rc   é   zeventually failingN)r“   rK   r(   s    r   Útest_itz!EventuallyFailingTestCase.test_itÿ   s>   € ð 	ˆŒ�!‰ˆŒØŒ6�QŠ;ˆ;Ø�IŠIÐ*Ñ+Ô+Ð+Ð+Ð+ð ˆ;r   N)r   r   r   r"   r“   r#   Ú__annotations__r–   r   r   r   r’   r’   ø   s>   € € € € € € ðð ð €A€s€J€J�Jð,ð ,ð ,ð ,ð ,r   r’   N)#r"   r   r   Útwisted.internetr   r   r   Útwisted.internet.taskr   Útwisted.trialr	   r   r   r   r%   ÚSynchronousTestCaser.   ÚTestCaser0   r2   r7   r:   r<   rC   rE   rG   rR   ra   rg   ri   rw   r~   r†   r�   r’   r   r   r   ú<module>r�      s   ðð
ð ð Ð Ð Ð Ð Ð à 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø (Ð (Ð (Ð (Ð (Ð (Ð (Ð (ð	ð 	ð 	ð 	ð 	�9ñ 	ô 	ð 	ð.ð .ð .ð .ð .�ñ .ô .ð .ðð ð ð ð ñ ô ð ð	ð 	ð 	ð 	ð 	Ð$7¸Ô9Uñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	Ð%8¸(Ô:Kñ 	ô 	ð 	ðð ð ð ð ñ ô ð ð	ð 	ð 	ð 	ð 	Ø˜HÔ8ñ	ô 	ð 	ð	ð 	ð 	ð 	ð 	Ð(>ÀÔ@Qñ 	ô 	ð 	ð1ð 1ð 1ð 1ð 1ñ 1ô 1ð 1ð"	ð 	ð 	ð 	ð 	Ø Ô!=ñ	ô 	ð 	ð	ð 	ð 	ð 	ð 	Ø Ô!2ñ	ô 	ð 	ð#ð #ð #ð #ð #�hÔ2ñ #ô #ð #ð*/ð */ð */ð */ð */˜8Ô,ñ */ô */ð */ðZð ð ð ð �Ô,ñ ô ð ð" €ˆÐ"Ñ#Ô#ð	ð 	ð 	ð 	ð 	�xÔ3ñ 	ô 	ñ $Ô#ð	ðð ð ð ð �(Ô#ñ ô ð ð:&ð &ð &ð &ð &˜(Ô+ñ &ô &ð &ð ð  ð  ð  ð  �XÔ&ñ  ô  ð  ð
ð 
ð 
ð 
ð 
˜Ô)ñ 
ô 
ð 
ðð ð ð,ð ,ð ,ð ,ð , Ô <ñ ,ô ,ð ,ð ,ð ,r   