%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__/test_log.cpython-312.pyc

�

Ϫ�fh����dZddlZddlmZmZddlmZmZddlm	Z	m
Z
mZd�ZGd�d�Z
Gd	�d
ej�ZGd�d�ZGd
�deej�ZGd�deej$�Zy)zG
Test the interaction between trial and errors logged during test run.
�N)�reactor�task)�failure�log)�	_synctest�reporter�unittestc�Z�	ddzS#t$rtj�}Y|SwxYw)z*
    Return a new, realistic failure.
    �r)�ZeroDivisionErrorr�Failure)�fs �=/usr/lib/python3/dist-packages/twisted/trial/test/test_log.py�makeFailurers7���	�A��
�H�����O�O����H��s�	�*�*c�|�eZdZdZGd�d�ZGd�deej�ZGd�deej�Z	y)	�Maskz?
    Hide C{MockTest}s from Trial's automatic test finder.
    c�$�eZdZd�Zd�Zd�Zd�Zy)�Mask.FailureLoggingMixinc��y)z/
            Don't log any errors.
            N���selfs r�test_silentz$Mask.FailureLoggingMixin.test_silent s��c�>�tjt��y)z-
            Log a single error.
            N�r�errrrs r�test_singlez$Mask.FailureLoggingMixin.test_single%s��
�G�G�K�M�"rc�x�tjt��tjt��y)z)
            Log two errors.
            Nrrs r�test_doublez$Mask.FailureLoggingMixin.test_double+s ��
�G�G�K�M�"��G�G�K�M�"rc�H�tjt��ddzy)z8
            Log a single error, then fail.
            rNrrs r�test_singleThenFailz,Mask.FailureLoggingMixin.test_singleThenFail2s��
�G�G�K�M�"�
��HrN)�__name__�
__module__�__qualname__rrr r"rrr�FailureLoggingMixinrs��	�
	#�	#�	rr&c��eZdZy)�Mask.SynchronousFailureLoggingN)r#r$r%rrr�SynchronousFailureLoggingr(9s��rr)c��eZdZd�Zy)�Mask.AsynchronousFailureLoggingc�:�tjtdd��S)zC
            Log an error in an asynchronous callback.
            rc�<�tjt��S�Nrrrr�<lambda>zAMask.AsynchronousFailureLogging.test_inCallback.<locals>.<lambda>As��s�w�w�{�}�7M�r)r�
deferLaterrrs r�test_inCallbackz/Mask.AsynchronousFailureLogging.test_inCallback=s���?�?�7�A�/M�N�NrN)r#r$r%r1rrr�AsynchronousFailureLoggingr+<s��	Orr2N)
r#r$r%�__doc__r&r	�SynchronousTestCaser)�TestCaser2rrrrrs=�����4
�$7��9U�9U�
�O�%8�(�:K�:K�Orrc�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�
ObserverTestsz
    Tests for L{_synctest._LogObserver}, a helper for the implementation of
    L{SynchronousTestCase.flushLoggedErrors}.
    c�h�tj�|_tj�|_yr.)r�
TestResult�resultr�_LogObserver�observerrs r�setUpzObserverTests.setUpJs"���)�)�+���!�.�.�0��
rc��|jjdtj�ddd��|j|jj	�g�y)zW
        Test that a standard log message doesn't go anywhere near the result.
        )zsome messager�-)�message�time�isError�systemN)r<�gotEventrA�assertEqual�	getErrorsrs r�test_msgzObserverTests.test_msgNsL��	
�
�
���,��	�	����	
�	
�	
������0�0�2�B�7rc	���t�}|jjdtj�dd|dd��|j	|jj�|g�y)zF
        Test that an observed error gets added to the result
        rrr?N�r@rArBrCr�why)rr<rDrArErF�rrs  r�
test_errorzObserverTests.test_error\s[��
�M���
�
�����	�	������

�		
�	
������0�0�2�Q�C�8rc�0�|j�|jj�}|j|jj	�g�|jt|�d�|j
|djt��y)zS
        Check that flushing the observer with no args removes all errors.
        rrN)	rLr<�flushErrorsrErF�len�
assertTrue�checkr)r�flusheds  r�
test_flushzObserverTests.test_flushmsm��	
�����-�-�+�+�-��������0�0�2�B�7�����W��q�)������
�(�(�):�;�<rc�>�tjtd��S)Nz
test error)rr
�RuntimeErrorrs r�_makeRuntimeFailurez!ObserverTests._makeRuntimeFailurews�����|�L�9�:�:rc
���|j�|j�}|jjt	dtj
�dd|d���|jj
t�}|j|jj�|g�|jt|�d�|j|djt��y)zY
        Check that flushing the observer remove all failures of the given type.
        rrr?NrIr)
rLrVr<rD�dictrArNrrErFrOrPrQ)rrrRs   r�test_flushByTypezObserverTests.test_flushByTypezs���	
�����$�$�&���
�
���������a��Q�TX�
�	
�
�-�-�+�+�,=�>��������0�0�2�Q�C�8�����W��q�)������
�(�(�):�;�<rc	��|jjt�t�}|jj	dtj
�dd|dd��|j
|jj�g�y)zS
        Check that C{_ignoreErrors} actually causes errors to be ignored.
        rrr?NrI)r<�
_ignoreErrorsrrrDrArErFrKs  r�test_ignoreErrorszObserverTests.test_ignoreErrors�sl��	
�
�
�#�#�$5�6��M���
�
�����	�	������

�		
�	
������0�0�2�B�7rc	�H�|jjt�|jj�t	�}|jjdt
j�dd|dd��|j|jj�|g�y)zj
        Check that C{_clearIgnores} ensures that previously ignored errors
        get captured.
        rrr?NrI)	r<r[r�
_clearIgnoresrrDrArErFrKs  r�test_clearIgnoreszObserverTests.test_clearIgnores�s~��
	
�
�
�#�#�$5�6��
�
�#�#�%��M���
�
�����	�	������

�		
�	
������0�0�2�Q�C�8rN)r#r$r%r3r=rGrLrSrVrYr\r_rrrr7r7Ds/���
1�8�9�"=�;�=� 8�$9rr7c�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�LogErrorsMixinzb
    High-level tests demonstrating the expected behaviour of logged errors
    during tests.
    c�6�tj�|_yr.)rr9r:rs rr=zLogErrorsMixin.setUp�s���)�)�+��rc�.�|jt�yr.)�flushLoggedErrorsrrs r�tearDownzLogErrorsMixin.tearDown�s�����0�1rc��|jd�}||j�|jt|jj�d�|j|jjddj
t�|jjdd�|jd|jj�y)zI
        Test that a logged error gets reported as a test error.
        rrrN)	�MockTestr:rErO�errorsrPrQr�	successes�r�tests  r�test_singleErrorzLogErrorsMixin.test_singleError�s����}�}�]�+���T�[�[������T�[�[�/�/�0�!�4�����K�K���q�!�!�$�*�*�+<�=�t�{�{�?Q�?Q�RS�?T�UV�?W�	
�	
����D�K�K�1�1�2rc���|jd�}||j�|jt|jj�d�|jd|jj
�y)zf
        Test that when two errors get logged, they both get reported as test
        errors.
        r �rN�rgr:rErOrhrirjs  r�test_twoErrorszLogErrorsMixin.test_twoErrors�sW��
�}�}�]�+���T�[�[������T�[�[�/�/�0�!�4�����D�K�K�1�1�2rc��|jd�}|jd�}||j�||j�|jt|jj�d�|j|jjdd|�|jd|jj
�y)zT
        Check that an error logged in one test doesn't fail the next test.
        rrrrNro�r�t1�t2s   r�test_errorsIsolatedz"LogErrorsMixin.test_errorsIsolated�s����]�]�=�
)��
�]�]�=�
)��
�4�;�;��
�4�;�;������T�[�[�/�/�0�!�4�������+�+�A�.�q�1�2�6�����D�K�K�1�1�2rc��|jd�}|jd�}||j�||j�|jt|jj�d�|j|jjdd|�|jjddjt�|j|jjdd|�|jjddjt�|jd|jj�y)zN
        An error logged in a failed test doesn't fail the next test.
        r"rrnrrN)	rgr:rErOrh�trap�	TypeErrorrrirrs   r� test_errorsIsolatedWhenTestFailsz/LogErrorsMixin.test_errorsIsolatedWhenTestFails�s����]�]�0�
1��
�]�]�=�
)��
�4�;�;��
�4�;�;������T�[�[�/�/�0�!�4�������+�+�A�.�q�1�2�6������1��a� �%�%�i�0�������+�+�A�.�q�1�2�6������1��a� �%�%�&7�8�����D�K�K�1�1�2rc�,�tj�}|jtd|�tjj
dd}|j
�}||j�|j|tjj
�y)zE
        There are no extra log observers after a test runs.
        �_logObserverN)	rr;�patchr�theLogPublisher�	observersrgr:rE)rr<r~rks    r�test_boundedObserversz$LogErrorsMixin.test_boundedObservers�sk��
�)�)�+���
�
�9�n�h�7��'�'�1�1�!�4�	��}�}����T�[�[������C�$7�$7�$A�$A�BrN)r#r$r%r3r=rerlrpruryrrrrrara�s+���
,�2�
3�3�
3�3�$
Crrac�$�eZdZejZy)�SynchronousLogErrorsTestsN)r#r$r%rr)rgrrrr�r��s
���-�-�Hrr�c�*�eZdZejZd�Zy)�AsynchronousLogErrorsTestsc�Z�|jd�}||j�|jt|jj�d�|j|jjddj
t�|jjdd�y)zS
        Test that errors logged in callbacks get reported as test errors.
        r1rrN)rgr:rErOrhrPrQrrjs  rr1z*AsynchronousLogErrorsTests.test_inCallbacks����}�}�.�/���T�[�[������T�[�[�/�/�0�!�4�����K�K���q�!�!�$�*�*�+<�=�t�{�{�?Q�?Q�RS�?T�UV�?W�	
rN)r#r$r%rr2rgr1rrrr�r�s���.�.�H�	
rr�)r3rA�twisted.internetrr�twisted.pythonrr�
twisted.trialrrr	rrr4r7rar�r5r�rrr�<module>r�sy����*�'�7�7�
�'O�'O�Tj9�H�0�0�j9�ZJC�JC�Z.���0L�0L�.�
���1B�1B�
r

Zerion Mini Shell 1.0