
    ha                     n    S r SSKJr  SSKJr  SSKJr   " S S\5      r " S S	\5      r	 " S
 S\5      r
g)z!
Tests for hyperlink.test.common
    )Any)TestCase   )HyperlinkTestCasec                       \ rS rSrSrSrg)_ExpectedException	   9An exception used to test HyperlinkTestCase.assertRaises. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       a/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/hyperlink/test/test_common.pyr   r   	       Cr   r   c                       \ rS rSrSrSrg)_UnexpectedException   r
   r   Nr   r   r   r   r   r      r   r   r   c                   B    \ rS rSrSrS rS rS rS rS r	S r
S	 rS
rg)TestHyperlink   zTests for HyperlinkTestCasec                 $    [        S5      U l        g )Nrun)r   hyperlink_testselfs    r   setUpTestHyperlink.setUp   s    /6r   c                    ^ / mU4S jnU R                   R                  [        USSS9  U R                  TSSS04/5        g)zHyperlinkTestCase.assertRaises does not raise an AssertionError
when given a callable that, when called with the provided
arguments, raises the expected exception.

c                  4   > TR                  X45        [        eN)appendr   )argskwargscalled_withs     r   raisesExpectedCTestHyperlink.test_assertRaisesWithCallable.<locals>.raisesExpected!   s    ~.$$r   r   T)keyword)r   r,   N)r   assertRaisesr   assertEqual)r    r*   r)   s     @r   test_assertRaisesWithCallable+TestHyperlink.test_assertRaisesWithCallable   sR     	%
 	((4 	) 	
 	y$.?'@&ABr   c                 l    S n U R                   R                  [        U5        g! [         a     gf = f)zrWhen given a callable that raises an unexpected exception,
HyperlinkTestCase.assertRaises raises that exception.

c                      [         er%   )r   r'   r(   s     r   doesNotRaiseExpected\TestHyperlink.test_assertRaisesWithCallableUnexpectedException.<locals>.doesNotRaiseExpected2   s    &&r   Nr   r-   r   r   )r    r4   s     r   0test_assertRaisesWithCallableUnexpectedException>TestHyperlink.test_assertRaisesWithCallableUnexpectedException+   s:    	'	,,"$8 $ 		    & 
33c                 l    S n U R                   R                  [        U5        g! [         a     gf = f)zHyperlinkTestCase.assertRaises raises an AssertionError when given
a callable that, when called, does not raise any exception.

c                      g r%   r   r3   s     r   doesNotRaiseMTestHyperlink.test_assertRaisesWithCallableDoesNotRaise.<locals>.doesNotRaiseD   s    r   Nr   r-   r   AssertionError)r    r<   s     r   )test_assertRaisesWithCallableDoesNotRaise7TestHyperlink.test_assertRaisesWithCallableDoesNotRaise=   s5    		,,-?N 		r9   c                     U R                   R                  [        5       n[        e! , (       d  f       O= fU R                  [	        WR
                  [        5      5        g)zHyperlinkTestCase.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_assertRaisesContextManager-TestHyperlink.test_assertRaisesContextManagerM   sH       --.@AR$$ BA 	r||%78	
s   '
5c                      U R                   R                  [        5         [        e! , (       d  f       g= f! [         a     gf = f)zWhen used as a context manager with a block that raises an
unexpected exception, HyperlinkTestCase.assertRaises raises
that unexpected exception.

Nr6   r   s    r   2test_assertRaisesContextManagerUnexpectedException@TestHyperlink.test_assertRaisesContextManagerUnexpectedException\   s=    	$$112DE** FE# 		s   9 (
69 9 
AAc                      U R                   R                  [        5          SSS5        g! , (       d  f       g= f! [         a     gf = f)zHyperlinkTestcase.assertRaises raises an AssertionError when used
as a context manager with a block that does not raise any
exception.

Nr>   r   s    r   +test_assertRaisesContextManagerDoesNotRaise9TestHyperlink.test_assertRaisesContextManagerDoesNotRaisei   s=    	$$112DE FEE 		s#   = ,= 
:= = 
A
	A
)r   N)r   r   r   r   r   r!   r/   r7   r@   rG   rJ   rM   r   r   r   r   r   r      s)    %7C&$ 
r   r   N)r   typingr   unittestr   commonr   	Exceptionr   r   r   r   r   r   <module>rS      s?      %D DD9 DcH cr   