File: //usr/lib/python3/dist-packages/twisted/trial/test/__pycache__/test_suppression.cpython-310.pyc
o
�b � @ sV d Z ddlZddlmZ ddlmZ ddlmZ G dd� d�ZG dd � d eej �Z
dS )
z2
Tests for warning suppression features of Trial.
� N)�namedAny)�unittest)�suppressionc @ sX e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� ZdS )�SuppressionMixinzj
Tests for the warning suppression features of
L{twisted.trial.unittest.SynchronousTestCase}.
c C s |� t�� � d S )N)�run�pyunit�
TestResult)�self�suite� r �E/usr/lib/python3/dist-packages/twisted/trial/test/test_suppression.py�runTests s zSuppressionMixin.runTestsc C s t �||�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 � TestSuite)r �cls�
methodNamer r r �_load s zSuppressionMixin._loadc C s | � 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.
c S s g | ]}|d �qS )�messager )�.0�warningr r r �
<listcomp>2 s z4SuppressionMixin._assertWarnings.<locals>.<listcomp>N)�assertEqual)r �warnings�whichr r r �_assertWarnings# s z SuppressionMixin._assertWarningsc C �D | � | �| 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�_emitr r �CLASS_WARNING_MSG�MODULE_WARNING_MSG�r �
warningsShownr r r �test_setUpSuppression4 � ��z&SuppressionMixin.test_setUpSuppressionc C r )z�
Suppressions defined by the test method being run are applied to any
warnings emitted while running the C{tearDown} fixture.
r N) r
r �TestTearDownSuppressionr r r r r r r! r r r �test_tearDownSuppressionE r$ z)SuppressionMixin.test_tearDownSuppressionc C s<