o
    G_a                     @   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                   @      e Zd ZdZdS )_ExpectedException9An exception used to test HyperlinkTestCase.assertRaises.N__name__
__module____qualname____doc__ r   r   </usr/lib/python3/dist-packages/hyperlink/test/test_common.pyr   	       r   c                   @   r   )_UnexpectedExceptionr   Nr	   r   r   r   r   r      r   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 )	zHyperlinkTestCase.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N)appendr   argskwargs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   2   dd }z
| j t| W dS  ty   Y dS w )zWhen given a callable that raises an unexpected exception,
        HyperlinkTestCase.assertRaises raises that exception.

        c                  _   s   t r   )r   r   r   r   r   doesNotRaiseExpected2      z\TestHyperlink.test_assertRaisesWithCallableUnexpectedException.<locals>.doesNotRaiseExpectedNr   r!   r   r   )r   r%   r   r   r   0test_assertRaisesWithCallableUnexpectedException+   s   
z>TestHyperlink.test_assertRaisesWithCallableUnexpectedExceptionc                 C   r$   )zHyperlinkTestCase.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   r&   zMTestHyperlink.test_assertRaisesWithCallableDoesNotRaise.<locals>.doesNotRaiseNr   r!   r   AssertionError)r   r)   r   r   r   )test_assertRaisesWithCallableDoesNotRaise=   s   z7TestHyperlink.test_assertRaisesWithCallableDoesNotRaisec                 C   s8   | j t}t1 sw   Y  | 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1 sw   Y  W dS  ty   Y dS w )zWhen 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   sL   z| j t
 W d   W dS 1 sw   Y  W dS  ty%   Y dS w )zHyperlinkTestcase.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,   r1   r2   r3   r   r   r   r   r      s    r   N)r   typingr   unittestr   commonr   	Exceptionr   r   r   r   r   r   r   <module>   s    