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


W[
�@sVdZddlmZmZddlZddlmZddlm	Z	ddl
mZGdd�dej�ZdS)	zL
Tests for async assertions provided by C{twisted.trial.unittest.TestCase}.
�)�division�absolute_importN)�failure)�defer)�unittestc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�AsynchronousAssertionsTestszp
    Tests for L{TestCase}'s asynchronous extensions to L{SynchronousTestCase}.
    That is, assertFailure.
    cCst�dd��}|�|t�S)NcSsddS�N�r�r
r
r
�I/usr/lib/python3/dist-packages/twisted/trial/test/test_asyncassertions.py�<lambda>�z@AsynchronousAssertionsTests.test_assertFailure.<locals>.<lambda>)r�
maybeDeferred�
assertFailure�ZeroDivisionError��self�dr
r
r�test_assertFailuresz.AsynchronousAssertionsTests.test_assertFailurecs:t�dd��}��|t�|��fdd��fdd��|S)NcSsddSrr
r
r
r
rrr
zOAsynchronousAssertionsTests.test_assertFailure_wrongException.<locals>.<lambda>cs
��d�S�NzShould have failed��fail��x�rr
rrr
cs|��j�S�N�Ztrap�failureExceptionrrr
rrr
)rrr�
OverflowError�addCallbacksrr
rr�!test_assertFailure_wrongExceptions
�z=AsynchronousAssertionsTests.test_assertFailure_wrongExceptioncs6t�d�}��|t�|��fdd��fdd��|S)Ncs
��d�Srrrrr
rr&r
zLAsynchronousAssertionsTests.test_assertFailure_noException.<locals>.<lambda>cs|��j�Srrrrr
rr'r
)rZsucceedrrrrr
rr�test_assertFailure_noException#s

�z:AsynchronousAssertionsTests.test_assertFailure_noExceptioncCsRzddWn&tk
r2t��}t�|�}YnX|�|t�}|�|j|�|S)z�
        In the case of assertFailure failing, check that we get lots of
        information about the exception that was raised.
        r	r)	rrZFailurerrr�RuntimeErrorZ
addErrback�
_checkInfo)r�frr
r
r�test_assertFailure_moreInfo+sz7AsynchronousAssertionsTests.test_assertFailure_moreInfocCs<|�|j�st�|��}|�|��|�|�|��|�dSr)Zcheckr�AssertionErrorZgetErrorMessageZassertInZgetBriefTraceback)rZassertionFailurer$�outputr
r
rr#:sz&AsynchronousAssertionsTests._checkInfocsVGdd�dt��G�fdd�dtj�}|d�}t��}|�|�|�dt|j��dS)zJ
        A single wrong assertFailure should fail the whole test.
        c@seZdZdS)zMAsynchronousAssertionsTests.test_assertFailure_masked.<locals>.ExampleFailureN)�__name__�
__module__�__qualname__r
r
r
r�ExampleFailureEsr+cseZdZ�Zdd�ZdS)zAAsynchronousAssertionsTests.test_assertFailure_masked.<locals>.TCcSs*t�dd��}|�|t�|�|t�|S)NcSsddSrr
r
r
r
rrKr
zfAsynchronousAssertionsTests.test_assertFailure_masked.<locals>.TC.test_assertFailure.<locals>.<lambda>)rrrrrrr
r
rrJszTAsynchronousAssertionsTests.test_assertFailure_masked.<locals>.TC.test_assertFailureN)r(r)r*rrr
�r+r
r�TCHsr-rr	N)	�	Exceptionr�TestCase�pyunitZ
TestResult�runZassertEqual�lenZfailures)rr-Ztest�resultr
r,r�test_assertFailure_maskedAs
z5AsynchronousAssertionsTests.test_assertFailure_maskedN)
r(r)r*�__doc__rr r!r%r#r4r
r
r
rrsr)
r5Z
__future__rrrr0Ztwisted.pythonrZtwisted.internetrZ
twisted.trialr/rr
r
r
r�<module>s