
    Tfa                         d Z ddlmZ ddlmZ ddlmZ  G d de          Z G d d	e          Z	 G 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__     L/var/www/html/env/lib/python3.11/site-packages/hyperlink/test/test_common.pyr   r   	           CCCCr   r   c                       e Zd ZdZdS )_UnexpectedExceptionr	   Nr
   r   r   r   r   r      r   r   r   c                   <    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	S )
TestHyperlinkzTests for HyperlinkTestCasec                 .    t          d          | _        d S )Nrun)r   hyperlink_testselfs    r   setUpzTestHyperlink.setUp   s    /66r   c                     g fd}| j                             t          |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                  @                         | |f           t          N)appendr   )argskwargscalled_withs     r   raisesExpectedzCTestHyperlink.test_assertRaisesWithCallable.<locals>.raisesExpected!   s!    f~...$$r   r   T)keyword)r   r%   N)r   assertRaisesr   assertEqual)r   r$   r#   s     @r   test_assertRaisesWithCallablez+TestHyperlink.test_assertRaisesWithCallable   sy     	% 	% 	% 	% 	%
 	((4 	) 	
 	
 	
 	y$.?'@&ABBBBBr   c                 p    d }	 | j                             t          |           dS # t          $ r Y dS w xY w)zWhen given a callable that raises an unexpected exception,
        HyperlinkTestCase.assertRaises raises that exception.

        c                      t           r   )r   r!   r"   s     r   doesNotRaiseExpectedz\TestHyperlink.test_assertRaisesWithCallableUnexpectedException.<locals>.doesNotRaiseExpected2   s    &&r   Nr   r&   r   r   )r   r,   s     r   0test_assertRaisesWithCallableUnexpectedExceptionz>TestHyperlink.test_assertRaisesWithCallableUnexpectedException+   se    	' 	' 	'	,,"$8     $ 	 	 	DD	    ' 
55c                 p    d }	 | j                             t          |           dS # t          $ r Y dS w xY w)zHyperlinkTestCase.assertRaises raises an AssertionError when given
        a callable that, when called, does not raise any exception.

        c                      d S r   r   r+   s     r   doesNotRaisezMTestHyperlink.test_assertRaisesWithCallableDoesNotRaise.<locals>.doesNotRaiseD   s    Dr   Nr   r&   r   AssertionError)r   r2   s     r   )test_assertRaisesWithCallableDoesNotRaisez7TestHyperlink.test_assertRaisesWithCallableDoesNotRaise=   sX    	 	 		,,-?NNNNN 	 	 	DD	r/   c                     | j                             t                    5 }t          # 1 swxY 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   cms     r   test_assertRaisesContextManagerz-TestHyperlink.test_assertRaisesContextManagerM   s      --.@AA 	%R$$	% 	% 	% 	% 	% 	% 	% 	% 	r|%788	
 	
 	
 	
 	
s   (,,c                     	 | j                             t                    5  t          # 1 swxY w Y   dS # t          $ r Y dS w xY w)zWhen used as a context manager with a block that raises an
        unexpected exception, HyperlinkTestCase.assertRaises raises
        that unexpected exception.

        Nr-   r   s    r   2test_assertRaisesContextManagerUnexpectedExceptionz@TestHyperlink.test_assertRaisesContextManagerUnexpectedException\   s    	$112DEE + +**+ + + + + + + + + +# 	 	 	DD	s#   6 )-6 -6 
AAc                     	 | j                             t                    5  	 ddd           dS # 1 swxY w Y   dS # t          $ r Y dS w xY w)zHyperlinkTestcase.assertRaises raises an AssertionError when used
        as a context manager with a block that does not raise any
        exception.

        Nr3   r   s    r   +test_assertRaisesContextManagerDoesNotRaisez9TestHyperlink.test_assertRaisesContextManagerDoesNotRaisei   s    	$112DEE                    	 	 	DD	s'   = 0= 4= 4= 
A
AN)r   r   r   r   r   r(   r.   r5   r;   r=   r?   r   r   r   r   r      s        %%7 7 7C C C&  $   
 
 
      r   r   N)r   typingr   unittestr   commonr   	Exceptionr   r   r   r   r   r   <module>rD      s                 % % % % % %D D D D D D D DD D D D D9 D D Dc c c c cH c c c c cr   