Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/testfixtures/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/testfixtures/__pycache__/shouldwarn.cpython-37.pyc

B

R�X'�@s>ddlZddlmZmZGdd�dej�ZGdd�de�ZdS)�N)�
Comparison�comparecs<eZdZdZdZ�fdd�Z�fdd�Z�fdd�Z�ZS)	�
ShouldWarna
    This context manager is used to assert that warnings are issued
    within the context it is managing.

    :param expected: This should be a sequence made up of one or more elements,
                     each of one of the following types:

                      * A warning class, indicating that the type
                        of the warnings is important but not the
                        parameters it is created with.

                      * A warning instance, indicating that a
                        warning exactly matching the one supplied
                        should have been issued.

                    If no expected warnings are passed, you will need to inspect
                    the contents of the list returned by the context manager.
    Fcs&tt|�jdd�dd�|D�|_dS)NT)�recordcSsg|]}t|��qS�)�C)�.0�err�H/opt/alt/python37/lib/python3.7/site-packages/testfixtures/shouldwarn.py�
<listcomp>sz'ShouldWarn.__init__.<locals>.<listcomp>)�superr�__init__�expected)�selfr)�	__class__rr
r
szShouldWarn.__init__cs tt|���|_t�d�|jS)N�always)rr�	__enter__�recorded�warnings�simplefilter)r)rrr
r s
zShouldWarn.__enter__csXtt|��|||�|js$|jr$dS|js:|jr:|js:dSt|jdd�|jD�d�dS)NcSsg|]
}|j�qSr)�message)rZwmrrr
r+sz'ShouldWarn.__exit__.<locals>.<listcomp>)�actual)rr�__exit__r�_empty_okayrr)r�exc_typeZexc_val�exc_tb)rrr
r%szShouldWarn.__exit__)	�__name__�
__module__�__qualname__�__doc__rr
rr�
__classcell__rr)rr
rs
rcs$eZdZdZdZ�fdd�Z�ZS)�
ShouldNotWarnzs
    This context manager is used to assert that no warnings are issued
    within the context it is managing.
    Tcstt|���dS)N)rr!r
)r)rrr
r
6szShouldNotWarn.__init__)rrrrrr
r rr)rr
r!.sr!)r�testfixturesrrr�catch_warningsrr!rrrr
�<module>s(