U
    *Wja  ã                   @   s\   d Z ddlmZ ddlmZ ddlmZ G dd„ deƒZG dd	„ d	eƒZ	G d
d„ deƒZ
dS )z!
Tests for hyperlink.test.common
é    )ÚAny)ÚTestCaseé   )ÚHyperlinkTestCasec                   @   s   e Zd ZdZdS )Ú_ExpectedExceptionú9An exception used to test HyperlinkTestCase.assertRaises.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   úec:\users\psant\downloads\hotstarbackend\school\venv38\Lib\site-packages\hyperlink/test/test_common.pyr   	   s   r   c                   @   s   e Zd ZdZdS )Ú_UnexpectedExceptionr   Nr   r   r   r   r   r      s   r   c                   @   sH   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dS )ÚTestHyperlinkzTests for HyperlinkTestCasec                 C   s   t dƒ| _d S )NÚrun)r   Úhyperlink_test©Úselfr   r   r   ÚsetUp   s    zTestHyperlink.setUpc                    s>   g ‰ ‡ fdd„}| j jt|ddd� |  ˆ dddifg¡ dS )	z½HyperlinkTestCase.assertRaises does not raise an AssertionError
        when given a callable that, when called with the provided
        arguments, raises the expected exception.

        c                     s   ˆ   | |f¡ t‚d S ©N)Úappendr   ©ÚargsÚkwargs©Zcalled_withr   r   ÚraisesExpected!   s    zCTestHyperlink.test_assertRaisesWithCallable.<locals>.raisesExpectedr   T)Úkeyword)r   r   N)r   ÚassertRaisesr   ÚassertEqual)r   r   r   r   r   Útest_assertRaisesWithCallable   s       ÿz+TestHyperlink.test_assertRaisesWithCallablec                 C   s4   dd„ }z| j  t|¡ W n tk
r.   Y nX dS )z‚When given a callable that raises an unexpected exception,
        HyperlinkTestCase.assertRaises raises that exception.

        c                  _   s   t ‚d S r   )r   r   r   r   r   ÚdoesNotRaiseExpected2   s    z\TestHyperlink.test_assertRaisesWithCallableUnexpectedException.<locals>.doesNotRaiseExpectedN©r   r   r   r   )r   r!   r   r   r   Ú0test_assertRaisesWithCallableUnexpectedException+   s     ÿz>TestHyperlink.test_assertRaisesWithCallableUnexpectedExceptionc                 C   s4   dd„ }z| j  t|¡ W n tk
r.   Y nX dS )z�HyperlinkTestCase.assertRaises raises an AssertionError when given
        a callable that, when called, does not raise any exception.

        c                  _   s   d S r   r   r   r   r   r   ÚdoesNotRaiseD   s    zMTestHyperlink.test_assertRaisesWithCallableDoesNotRaise.<locals>.doesNotRaiseN©r   r   r   ÚAssertionError)r   r$   r   r   r   Ú)test_assertRaisesWithCallableDoesNotRaise=   s
    z7TestHyperlink.test_assertRaisesWithCallableDoesNotRaisec              	   C   s2   | j  t¡�
}t‚W 5 Q R X |  t|jtƒ¡ dS )a  HyperlinkTestCase.assertRaises does not raise an AssertionError
        when used as a context manager with a suite that raises the
        expected exception.  The context manager stores the exception
        instance under its `exception` instance variable.

        N)r   r   r   Ú
assertTrueÚ
isinstanceÚ	exception)r   Úcmr   r   r   Útest_assertRaisesContextManagerM   s
    
ÿz-TestHyperlink.test_assertRaisesContextManagerc              	   C   s:   z | j  t¡�
 t‚W 5 Q R X W n tk
r4   Y nX dS )z«When used as a context manager with a block that raises an
        unexpected exception, HyperlinkTestCase.assertRaises raises
        that unexpected exception.

        Nr"   r   r   r   r   Ú2test_assertRaisesContextManagerUnexpectedException\   s
    z@TestHyperlink.test_assertRaisesContextManagerUnexpectedExceptionc              	   C   s6   z| j  t¡� W 5 Q R X W n tk
r0   Y nX dS )z HyperlinkTestcase.assertRaises raises an AssertionError when used
        as a context manager with a block that does not raise any
        exception.

        Nr%   r   r   r   r   Ú+test_assertRaisesContextManagerDoesNotRaisei   s
    z9TestHyperlink.test_assertRaisesContextManagerDoesNotRaiseN)r	   r
   r   r   r   r    r#   r'   r,   r-   r.   r   r   r   r   r      s   r   N)r   Útypingr   Zunittestr   Úcommonr   Ú	Exceptionr   r   r   r   r   r   r   Ú<module>   s   