B
    u9al  ã               @   s.   d dl Z G dd„ de jƒZedkr*e  ¡  dS )é    Nc               @   sd   e 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d„ Z
dd„ Zdd„ Zdd„ ZdS )ÚExceptionTestCasec             C   s\   d}d}d}z&yt dƒ‚W n   d}Y nX d}W d d}X |  |¡ |  |¡ |  |¡ d S )NFznyaa!T)Ú	ExceptionÚ
assertTrueÚassertFalse)ÚselfÚ
hit_exceptÚhit_elseÚhit_finally© r
   ú//usr/lib/python3.7/test_exception_variations.pyÚtest_try_except_else_finally   s    


z.ExceptionTestCase.test_try_except_else_finallyc             C   sT   d}d}d}zyW n   d}Y nX d}W d d}X |   |¡ |  |¡ |  |¡ d S )NFT)r   r   )r   r   r   r	   r
   r
   r   Ú)test_try_except_else_finally_no_exception   s    


z;ExceptionTestCase.test_try_except_else_finally_no_exceptionc             C   sJ   d}d}z"yt dƒ‚W n   d}Y nX W d d}X |  |¡ |  |¡ d S )NFzyarr!T)r   r   )r   r   r	   r
   r
   r   Útest_try_except_finally)   s    
z)ExceptionTestCase.test_try_except_finallyc             C   sB   d}d}zyW n   d}Y nX W d d}X |   |¡ |  |¡ d S )NFT)r   r   )r   r   r	   r
   r
   r   Ú$test_try_except_finally_no_exception7   s    
z6ExceptionTestCase.test_try_except_finally_no_exceptionc             C   s0   d}yt dƒ‚W n   d}Y nX |  |¡ d S )NFzahoy!T)r   r   )r   r   r
   r
   r   Útest_try_exceptE   s    
z!ExceptionTestCase.test_try_exceptc             C   s(   d}yW n   d}Y nX |   |¡ d S )NFT)r   )r   r   r
   r
   r   Útest_try_except_no_exceptionO   s    
z.ExceptionTestCase.test_try_except_no_exceptionc             C   sB   d}d}yt dƒ‚W n   d}Y nX d}|  |¡ |  |¡ d S )NFzfoo!T)r   r   r   )r   r   r   r
   r
   r   Útest_try_except_elseY   s    

z&ExceptionTestCase.test_try_except_elsec             C   s:   d}d}yW n   d}Y nX d}|   |¡ |  |¡ d S )NFT)r   r   )r   r   r   r
   r
   r   Ú!test_try_except_else_no_exceptiong   s    

z3ExceptionTestCase.test_try_except_else_no_exceptionc             C   s   d}zW d d}X |   |¡ d S )NFT)r   )r   r	   r
   r
   r   Útest_try_finally_no_exceptionu   s
    z/ExceptionTestCase.test_try_finally_no_exceptionc             C   sd   d}d}d}z.z"yt dƒ‚W n   d}Y nX W d d}X W d d}X |  |¡ |  |¡ |  |¡ d S )NFzinner exceptionT)r   r   )r   r	   Úhit_inner_exceptZhit_inner_finallyr
   r
   r   Útest_nested   s    


zExceptionTestCase.test_nestedc             C   s’   d}d}d}d}d}z@y&yW n   d}Y nX d}t dƒ‚W n   d}Y nX d}W d d}X |  |¡ |  |¡ |  |¡ |  |¡ |  |¡ d S )NFTzouter exception)r   r   r   )r   r   r	   r   r   Zhit_inner_elser
   r
   r   Útest_nested_else’   s*    





z"ExceptionTestCase.test_nested_elseN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r   r   r   r
   r
   r
   r   r      s   


r   Ú__main__)ZunittestZTestCaser   r   Úmainr
   r
   r
   r   Ú<module>   s    ,