ó
    ×›‘hÁ  ã                   óL  • S r SSKJr  SSKJrJrJr  SSKJr  SSK	JrJ
r
   " S S\5      r " S S	\5      r " S
 S5      r " S S\\R                  5      r " S S\\R"                  5      r " S S5      r " S S\\R                  5      r " S S\\R"                  5      r " S S5      r " S S\\R                  5      r " S S\\R"                  5      r " S S\R                  5      r " S S\R"                  5      r " S  S!\R                  5      r\" S"S#5       " S$ S%\R                  5      5       r " S& S'\R"                  5      r " S( S)\R"                  5      r " S* S+\R"                  5      r " S, S-\R"                  5      r S. r! " S/ S0\R                  5      r"g1)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                   ó   • \ rS rSrSrg)ÚFoolishErroré   © N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   ó    Ú`C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/trial/test/erroneous.pyr   r      ó   † Úr   r   c                   ó0   • \ rS rSrSrS\SS4S jrS rSrg)	Ú
LargeErroré   z^
An exception which has a string representation of at least a specified
number of characters.
ÚminSizeÚreturnNc                 ó:   • [         R                  U 5        Xl        g ©N)Ú	ExceptionÚ__init__r   )Úselfr   s     r   r   ÚLargeError.__init__!   s   € Ü×Ñ˜4Ô Ø�r   c                 ó,   • SU R                   -  nSU S3$ )NÚxzLargeError<I fail: Ú>©r   )r    Úlarges     r   Ú__str__ÚLargeError.__str__%   s   € Ø�d—l‘lÑ"ˆØ$ U G¨1Ð-Ð-r   r%   )	r   r   r   r   Ú__doc__Úintr   r'   r   r   r   r   r   r      s   † ñð
 ð ¨ô õ.r   r   c                   ó    • \ rS rSrS rS rSrg)ÚFailureInSetUpMixiné*   c                 ó   • [        S5      e)NzI am a broken setUp method©r   ©r    s    r   ÚsetUpÚFailureInSetUpMixin.setUp+   s   € ÜÐ7Ó8Ð8r   c                 ó   • g r   r   r0   s    r   Ú	test_noopÚFailureInSetUpMixin.test_noop.   ó   € Ør   r   N)r   r   r   r   r1   r4   r   r   r   r   r,   r,   *   s   † ò9õr   r,   c                   ó   • \ rS rSrSrg)ÚSynchronousTestFailureInSetUpé2   r   Nr   r   r   r   r8   r8   2   r   r   r8   c                   ó   • \ rS rSrSrg)ÚAsynchronousTestFailureInSetUpé6   r   Nr   r   r   r   r;   r;   6   r   r   r;   c                   ó    • \ rS rSrS rS rSrg)ÚFailureInTearDownMixiné:   c                 ó   • [        S5      e)NzI am a broken tearDown methodr/   r0   s    r   ÚtearDownÚFailureInTearDownMixin.tearDown;   s   € ÜÐ:Ó;Ð;r   c                 ó   • g r   r   r0   s    r   r4   Ú FailureInTearDownMixin.test_noop>   r6   r   r   N)r   r   r   r   rA   r4   r   r   r   r   r>   r>   :   s   † ò<õr   r>   c                   ó   • \ rS rSrSrg)Ú SynchronousTestFailureInTearDownéB   r   Nr   r   r   r   rF   rF   B   ó   † ò 	r   rF   c                   ó   • \ rS rSrSrg)Ú!AsynchronousTestFailureInTearDownéH   r   Nr   r   r   r   rJ   rJ   H   r   r   rJ   c                   ó(   • \ rS rSrSrSrS rS rSrg)ÚFailureButTearDownRunsMixinéL   z/
A test fails, but its L{tearDown} still runs.
Fc                 ó   • SU l         g ©NT©ÚtornDownr0   s    r   rA   Ú$FailureButTearDownRunsMixin.tearDownS   s	   € Øˆ�r   c                 ó   • [        S5      e)z
A test that fails.
zI am a broken testr/   r0   s    r   Ú
test_failsÚ&FailureButTearDownRunsMixin.test_failsV   s   € ô Ð/Ó0Ð0r   rQ   N)	r   r   r   r   r)   rR   rA   rU   r   r   r   r   rM   rM   L   s   † ñð €Hòõ1r   rM   c                   ó   • \ rS rSrSrg)Ú%SynchronousTestFailureButTearDownRunsé]   r   Nr   r   r   r   rX   rX   ]   rH   r   rX   c                   ó   • \ rS rSrSrg)Ú&AsynchronousTestFailureButTearDownRunséc   r   Nr   r   r   r   r[   r[   c   rH   r   r[   c                   ó&   • \ rS rSrS rS rS rSrg)ÚTestRegularFailéi   c                 ó&   • U R                  S5        g )NúI fail©Úfailr0   s    r   Ú	test_failÚTestRegularFail.test_failj   s   € Ø�	‰	�(Õr   c                 ó$   • U R                  5         g r   )Ú
subroutiner0   s    r   Útest_subfailÚTestRegularFail.test_subfailm   s   € Ø�‰Õr   c                 ó&   • U R                  S5        g )NzI fail insiderb   r0   s    r   rg   ÚTestRegularFail.subroutinep   s   € Ø�	‰	�/Õ"r   r   N)r   r   r   r   rd   rh   rg   r   r   r   r   r^   r^   i   s   † òòõ#r   r^   c                   óŠ   • \ rS rSrSrSrS\R                  S   4S jrS\R                  S   4S jr	SS jr
SS	 jrSS
 jrSrg)ÚTestAsynchronousFailét   z7
Test failures for L{unittest.TestCase} based classes.
ra   r   Nc                 ó:   • [        [        SU R                  S5      $ )zG
A test which fails in the callback of the returned L{defer.Deferred}.
r   zI fail later©r   r   rc   r0   s    r   rd   ÚTestAsynchronousFail.test_fail{   s   € ô œ' 1 d§i¡i°Ó@Ð@r   c                 óF   • [        [        SU R                  SSS-  -   5      $ )z_
A test which fails in the callback of the returned L{defer.Deferred}
with a very long string.
r   zI fail later: r#   é   rp   r0   s    r   Útest_failGreaterThan64kÚ,TestAsynchronousFail.test_failGreaterThan64k�   s#   € ô
 œ' 1 d§i¡iÐ1AÀCÈ%ÁKÑ1OÓPÐPr   c                 ó,   • [        U R                  5      e)z1
A test which raises an exception synchronously.
)r   Útextr0   s    r   Útest_exceptionÚ#TestAsynchronousFail.test_exceptionˆ   s   € ô ˜Ÿ	™	Ó"Ð"r   c                 ó   • [        S5      e)zS
A test which raises an exception with a long string representation
synchronously.
rs   )r   r0   s    r   Útest_exceptionGreaterThan64kÚ1TestAsynchronousFail.test_exceptionGreaterThan64kŽ   s   € ô
 ˜ÓÐr   c                 ó   • [        SS-  5      e)zo
A test which synchronously raises an exception with a long string
representation including non-ascii content.
u   â˜ƒi €  )r   r0   s    r   Ú#test_exceptionGreaterThan64kEncodedÚ8TestAsynchronousFail.test_exceptionGreaterThan64kEncoded•   s   € ô ˜¨Ñ-Ó.Ð.r   r   )r   N)r   r   r   r   r)   rw   r   ÚDeferredrd   rt   rx   r{   r~   r   r   r   r   rm   rm   t   sK   † ñð €DðA˜5Ÿ>™>¨$Ñ/ô AðQ¨¯©¸Ñ)=ô Qô#ô ÷	/r   rm   c                   ó"   • \ rS rSrSrSrS rSrg)Ú	ErrorTesté¡   z�
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                 ó   • SU l         SS-    g)z:
Set C{self.ran} to True and raise a C{ZeroDivisionError}
Té   r   N©Úranr0   s    r   Útest_fooÚErrorTest.test_fooª   s   € ð ˆŒØ	ˆA‹r   r†   N)r   r   r   r   r)   r‡   rˆ   r   r   r   r   r‚   r‚   ¡   s   † ñð €Cõr   r‚   Tzskipping this testc                   ó   • \ rS rSrSrg)ÚTestSkipTestCaseé²   r   Nr   r   r   r   r‹   r‹   ²   s   † âr   r‹   c                   óR   • \ rS rSrSrS rS r\R                  " S\	S9/\l        Sr
g)	ÚDelayedCallé·   zsomething blew upc                 ó,   • [        U R                  5      er   )ÚRuntimeErrorÚhiddenExceptionMsgr0   s    r   ÚgoÚDelayedCall.goº   s   € Ü˜4×2Ñ2Ó3Ð3r   c                 ó”   • [         R                  " SU R                  5        [         R                  " S5        U R	                  S5        g)an  
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   Ú	callLaterr“   Úiteraterc   r0   s    r   ÚtestHiddenExceptionÚDelayedCall.testHiddenException½   s1   € ô 	×Ò˜!˜TŸW™WÔ%Ü�Š˜ÔØ�	‰	ÐCÕDr   z!reactor\.iterate cannot be used.*)ÚmessageÚcategoryr   N)r   r   r   r   r’   r“   r˜   r	   ÚsuppressÚDeprecationWarningr   r   r   r   rŽ   rŽ   ·   s2   † Ø,Ðò4òEð" 	�ŠØ8ÐCUñ	
ð$Ð× r   rŽ   c                   ó   • \ rS rSrS rSrg)ÚReactorCleanupTestséÔ   c                 ó8   • S n[         R                  " SU5        g )Nc                  ó   • [        S5        g )Nzfoo!)Úprintr   r   r   Ú_Ú8ReactorCleanupTests.test_leftoverPendingCalls.<locals>._Ö   s	   € Ü�&�Mr   g     ˆÃ@)r   r–   )r    r¤   s     r   Útest_leftoverPendingCallsÚ-ReactorCleanupTests.test_leftoverPendingCallsÕ   s   € ò	ô 	×Ò˜' 1Õ%r   r   N)r   r   r   r   r¦   r   r   r   r   rŸ   rŸ   Ô   s   † õ&r   rŸ   c                   ó   • \ rS rSrS rSrg)ÚSocketOpenTestéÜ   c                 ó†   • [         R                  " 5       n[         R                  Ul         [        R                  " SU5        g )Nr   )r   ÚFactoryÚProtocolr   Ú	listenTCP)r    Úfs     r   Útest_socketsLeftOpenÚ#SocketOpenTest.test_socketsLeftOpenÝ   s-   € Ü×ÒÓˆÜ×&Ñ&ˆŒ
Ü×Ò˜!˜QÕr   r   N)r   r   r   r   r°   r   r   r   r   r©   r©   Ü   s   † õ r   r©   c                   ó&   • \ rS rSrS rS rS rSrg)ÚTimingOutDeferredéã   c                 ó   • g r   r   r0   s    r   Ú
test_alphaÚTimingOutDeferred.test_alphaä   r6   r   c                 ó>   • SU l         [        R                  " 5       nU$ rP   )ÚmethodCalledr   r€   )r    Úds     r   Útest_deferredThatNeverFiresÚ-TimingOutDeferred.test_deferredThatNeverFiresç   s   € Ø ˆÔÜ�NŠNÓˆØˆr   c                 ó   • g r   r   r0   s    r   Ú
test_omegaÚTimingOutDeferred.test_omegaì   r6   r   )r¹   N)r   r   r   r   r¶   r»   r¾   r   r   r   r   r³   r³   ã   s   † òòõ
r   r³   c                 ó   • g)zWi will raise an unexpected exception...
... *CAUSE THAT'S THE KINDA GUY I AM*

>>> 1/0
Nr   r0   s    r   ÚunexpectedExceptionrÁ   ð   s   � r   c                   ó.   • \ rS rSr% SrSr\\S'   S rSr	g)ÚEventuallyFailingTestCaseéø   z6
A test suite that fails after it is run a few times.
r   Únc                 ór   • U =R                   S-  sl         U R                   S:¼  a  U R                  S5        gg)z;
Run successfully a few times and then fail forever after.
r…   é   zeventually failingN)rÅ   rc   r0   s    r   Útest_itÚ!EventuallyFailingTestCase.test_itÿ   s.   € ð 	�Š�!‰�Ø�6‰6�Q‹;Ø�I‰IÐ*Õ+ð r   r   N)
r   r   r   r   r)   rÅ   r*   Ú__annotations__rÈ   r   r   r   r   rÃ   rÃ   ø   s   ‡ ñð €A€sƒJõ,r   rÃ   N)#r)   r   r   Útwisted.internetr   r   r   Útwisted.internet.taskr   Útwisted.trialr	   r   r   r   r,   ÚSynchronousTestCaser8   ÚTestCaser;   r>   rF   rJ   rM   rX   r[   r^   rm   r‚   r‹   rŽ   rŸ   r©   r³   rÁ   rÃ   r   r   r   Ú<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   