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_suppression.cpython-38.pyc
U


W[��@shdZddlmZmZddlZddlmZddlmZddl	m
Z
Gdd�de�ZGd	d
�d
eej
�ZdS)z2
Tests for warning suppression features of Trial.
�)�division�absolute_importN)�namedAny)�unittest)�suppressionc@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�SuppressionMixinzj
    Tests for the warning suppression features of
    L{twisted.trial.unittest.SynchronousTestCase}.
    cCs|�t���dS)N)�run�pyunitZ
TestResult)�selfZsuite�r�E/usr/lib/python3/dist-packages/twisted/trial/test/test_suppression.py�runTestsszSuppressionMixin.runTestscCst�||�g�S)z�
        Return a new L{unittest.TestSuite} with a single test method in it.

        @param cls: A L{TestCase} subclass defining a test method.

        @param methodName: The name of the test method from C{cls}.
        )r	Z	TestSuite)r
�clsZ
methodNamerrr�_loadszSuppressionMixin._loadcCs|�dd�|D�|�dS)a&
        Assert that a certain number of warnings with certain messages were
        emitted in a certain order.

        @param warnings: A list of emitted warnings, as returned by
            C{flushWarnings}.

        @param which: A list of strings giving warning messages that should
            appear in C{warnings}.

        @raise self.failureException: If the warning messages given by C{which}
            do not match the messages in the warning information in C{warnings},
            or if they do not appear in the same order.
        cSsg|]}|d�qS)�messager)�.0Zwarningrrr�
<listcomp>5sz4SuppressionMixin._assertWarnings.<locals>.<listcomp>N)�assertEqual)r
�warningsZwhichrrr�_assertWarnings%s�z SuppressionMixin._assertWarningscCsD|�|�|jd��|�|jjg�}|�|tjtjtjtjg�dS)z�
        Suppressions defined by the test method being run are applied to any
        warnings emitted while running the C{setUp} fixture.
        �testSuppressMethodN)	r
r�TestSetUpSuppression�
flushWarnings�_emitrr�CLASS_WARNING_MSG�MODULE_WARNING_MSG�r
Z
warningsShownrrr�test_setUpSuppression9s����z&SuppressionMixin.test_setUpSuppressioncCsD|�|�|jd��|�|jjg�}|�|tjtjtjtjg�dS)z�
        Suppressions defined by the test method being run are applied to any
        warnings emitted while running the C{tearDown} fixture.
        rN)	r
r�TestTearDownSuppressionrrrrrrrrrr�test_tearDownSuppressionHs����z)SuppressionMixin.test_tearDownSuppressioncCs<|�|�|jd��|�|jjg�}|�|tjtjg�dS)z�
        A suppression set on a test method prevents warnings emitted by that
        test method which the suppression matches from being emitted.
        rN)	r
r�TestSuppressionrrrrrrrrrr�test_suppressMethodWs��
�z$SuppressionMixin.test_suppressMethodcCsd|�|�|jd��|�|jjg�}|�|ddtj�|�|ddtj�|�t	|�d�dS)z�
        A suppression set on a L{SynchronousTestCase} subclass prevents warnings
        emitted by any test methods defined on that class which match the
        suppression from being emitted.
        ZtestSuppressClassrr��N)
r
rr rrrr�METHOD_WARNING_MSGr�lenrrrr�test_suppressClasses��
�
�z#SuppressionMixin.test_suppressClasscCsd|�|�|jd��|�|jjg�}|�|ddtj�|�|ddtj	�|�t
|�d�dS)z�
        A suppression set on a module prevents warnings emitted by any test
        mewthods defined in that module which match the suppression from being
        emitted.
        ZtestSuppressModulerrr"r#N)r
r�TestSuppression2rr rrrr$rr%rrrr�test_suppressModulevs��
�
�z$SuppressionMixin.test_suppressModulecCsz|�|�|jd��|�|jjg�}|�|ddtj�|�|ddtj�|�|ddtj	�|�t
|�d�dS)z�
        The suppression set on a test method completely overrides a suppression
        with wider scope; if it does not match a warning emitted by that test
        method, the warning is emitted, even if a wider suppression matches.
        ZtestOverrideSuppressClassrrr"r#�N)r
rr rrrrr$rrr%rrrr�test_overrideSuppressClass�s&��
�
�
�z+SuppressionMixin.test_overrideSuppressClassN)
�__name__�
__module__�__qualname__�__doc__r
rrrrr!r&r(r*rrrrrsrc@s0eZdZdZed�Zed�Zed�Zed�ZdS)�SynchronousSuppressionTestsz0
    @see: L{twisted.trial.test.test_tests}
    z>twisted.trial.test.suppression.SynchronousTestSetUpSuppressionzAtwisted.trial.test.suppression.SynchronousTestTearDownSuppressionz9twisted.trial.test.suppression.SynchronousTestSuppressionz:twisted.trial.test.suppression.SynchronousTestSuppression2N)	r+r,r-r.rrrr r'rrrrr/�s����r/)r.Z
__future__rrrr	Ztwisted.python.reflectrZ
twisted.trialZtwisted.trial.testr�objectrZSynchronousTestCaser/rrrr�<module>s