§
    Ètºfø	  ã                   ó\   — d Z ddlZddlmZ ddlmZ ddlmZ  G d„ dej        ¦  «        Z	dS )zL
Tests for async assertions provided by C{twisted.trial.unittest.TestCase}.
é    N)Údefer)Úfailure)Úunittestc                   ó6   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	ÚAsynchronousAssertionsTestszp
    Tests for L{TestCase}'s asynchronous extensions to L{SynchronousTestCase}.
    That is, assertFailure.
    c                 ób   — t          j        d„ ¦  «        }|                      |t          ¦  «        S )Nc                  ó   — ddz  S ©Né   r   © r   ó    úf/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/trial/test/test_asyncassertions.pyú<lambda>z@AsynchronousAssertionsTests.test_assertFailure.<locals>.<lambda>   ó
   € ¨¨A©€ r   )r   ÚmaybeDeferredÚassertFailureÚZeroDivisionError©ÚselfÚds     r   Útest_assertFailurez.AsynchronousAssertionsTests.test_assertFailure   s+   € ÝÔ  Ñ.Ô.ˆØ×!Ò! !Õ%6Ñ7Ô7Ð7r   c                 ó    ‡ — t          j        d„ ¦  «        }‰                      |t          ¦  «         |                     ˆ fd„ˆ fd„¦  «         |S )Nc                  ó   — ddz  S r
   r   r   r   r   r   zOAsynchronousAssertionsTests.test_assertFailure_wrongException.<locals>.<lambda>   r   r   c                 ó.   •— ‰                      d¦  «        S ©NzShould have failed©Úfail©Úxr   s    €r   r   zOAsynchronousAssertionsTests.test_assertFailure_wrongException.<locals>.<lambda>   ó   ø€ �d—i’iÐ 4Ñ5Ô5€ r   c                 ó8   •— |                       ‰j        ¦  «        S ©N©ÚtrapÚfailureExceptionr   s    €r   r   zOAsynchronousAssertionsTests.test_assertFailure_wrongException.<locals>.<lambda>   ó   ø€ �a—f’f˜TÔ2Ñ3Ô3€ r   )r   r   r   ÚOverflowErrorÚaddCallbacksr   s   ` r   Ú!test_assertFailure_wrongExceptionz=AsynchronousAssertionsTests.test_assertFailure_wrongException   s`   ø€ ÝÔ  Ñ.Ô.ˆØ×Ò˜1�mÑ,Ô,Ð,Ø	�ŠØ5Ð5Ð5Ð5Ø3Ð3Ð3Ð3ñ	
ô 	
ð 	
ð ˆr   c                 óž   ‡ — t          j        d ¦  «        }‰                      |t          ¦  «         |                     ˆ fd„ˆ fd„¦  «         |S )Nc                 ó.   •— ‰                      d¦  «        S r   r   r   s    €r   r   zLAsynchronousAssertionsTests.test_assertFailure_noException.<locals>.<lambda>'   r    r   c                 ó8   •— |                       ‰j        ¦  «        S r"   r#   r   s    €r   r   zLAsynchronousAssertionsTests.test_assertFailure_noException.<locals>.<lambda>(   r&   r   )r   Úsucceedr   r   r(   r   s   ` r   Útest_assertFailure_noExceptionz:AsynchronousAssertionsTests.test_assertFailure_noException#   s^   ø€ ÝŒM˜$ÑÔˆØ×Ò˜1Õ/Ñ0Ô0Ð0Ø	�ŠØ5Ð5Ð5Ð5Ø3Ð3Ð3Ð3ñ	
ô 	
ð 	
ð ˆr   c                 óî   — 	 ddz   n7# t           $ r* t          j        ¦   «         }t          j        |¦  «        }Y nw xY w|                      |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   )	r   r   ÚFailurer   r   r   ÚRuntimeErrorÚ
addErrbackÚ
_checkInfo)r   Úfr   s      r   Útest_assertFailure_moreInfoz7AsynchronousAssertionsTests.test_assertFailure_moreInfo,   s}   € ð
	Ø�‰EˆEˆEøÝ ð 	ð 	ð 	Ý”Ñ!Ô!ˆAÝ”
˜1‘”ˆAˆAˆAð	øøøð ×Ò˜q¥,Ñ/Ô/ˆØ	�Š�T”_ aÑ(Ô(Ð(Øˆs   ‚ ˆ1<»<c                 ó  — |                      | j        ¦  «        sJ ‚|                     ¦   «         }|                      |                     ¦   «         |¦  «         |                      |                     ¦   «         |¦  «         d S r"   )Úcheckr%   ÚgetErrorMessageÚassertInÚgetBriefTraceback)r   ÚassertionFailurer4   Úoutputs       r   r3   z&AsynchronousAssertionsTests._checkInfo:   sv   € Ø×%Ò% dÔ&;Ñ<Ô<Ð<Ð<Ð<Ø!×1Ò1Ñ3Ô3ˆØ�Š�a×'Ò'Ñ)Ô)¨6Ñ2Ô2Ð2Ø�Š�a×)Ò)Ñ+Ô+¨VÑ4Ô4Ð4Ð4Ð4r   c                 ó  ‡—  G d„ dt           ¦  «        Š G ˆfd„dt          j        ¦  «        } |d¦  «        }t          j        ¦   «         }|                     |¦  «         |                      dt          |j        ¦  «        ¦  «         dS )zJ
        A single wrong assertFailure should fail the whole test.
        c                   ó   — e Zd ZdS )úMAsynchronousAssertionsTests.test_assertFailure_masked.<locals>.ExampleFailureN)Ú__name__Ú
__module__Ú__qualname__r   r   r   ÚExampleFailurer?   E   s   € € € € € ØˆDr   rC   c                   ó   •— e Zd Z” Zd„ ZdS )úAAsynchronousAssertionsTests.test_assertFailure_masked.<locals>.TCc                 óœ   — t          j        d„ ¦  «        }|                      |t          ¦  «         |                      |t          ¦  «         |S )Nc                  ó   — ddz  S r
   r   r   r   r   r   zfAsynchronousAssertionsTests.test_assertFailure_masked.<locals>.TC.test_assertFailure.<locals>.<lambda>L   s
   € °°A±€ r   )r   r   r   r'   r   r   s     r   r   zTAsynchronousAssertionsTests.test_assertFailure_masked.<locals>.TC.test_assertFailureK   sF   € ÝÔ'¨¨Ñ6Ô6�Ø×"Ò" 1¥mÑ4Ô4Ð4Ø×"Ò" 1Õ&7Ñ8Ô8Ð8Ø�r   N)r@   rA   rB   r%   r   )rC   s   €r   ÚTCrE   H   s*   ø€ € € € € Ø-Ððð ð ð ð r   rH   r   r   N)	Ú	Exceptionr   ÚTestCaseÚpyunitÚ
TestResultÚrunÚassertEqualÚlenÚfailures)r   rH   ÚtestÚresultrC   s       @r   Útest_assertFailure_maskedz5AsynchronousAssertionsTests.test_assertFailure_masked@   s¼   ø€ ð
	ð 	ð 	ð 	ð 	�Yñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	ð 	ð 	•Ô"ñ 	ô 	ð 	ð ˆrÐ&Ñ'Ô'ˆÝÔ"Ñ$Ô$ˆØ�Š�ÑÔÐØ×Ò˜�C ¤Ñ0Ô0Ñ1Ô1Ð1Ð1Ð1r   N)
r@   rA   rB   Ú__doc__r   r)   r.   r5   r3   rS   r   r   r   r   r      sx   € € € € € ðð ð
8ð 8ð 8ðð ð ðð ð ðð ð ð5ð 5ð 5ð2ð 2ð 2ð 2ð 2r   r   )
rT   r   rK   Útwisted.internetr   Útwisted.pythonr   Útwisted.trialrJ   r   r   r   r   ú<module>rX      s”   ððð ð
 Ð Ð Ð à "Ð "Ð "Ð "Ð "Ð "Ø "Ð "Ð "Ð "Ð "Ð "Ø "Ð "Ð "Ð "Ð "Ð "ðD2ð D2ð D2ð D2ð D2 (Ô"3ñ D2ô D2ð D2ð D2ð D2r   