U
    .‰d  ã                   @   sT   d Z ddlmZmZmZ G dd„ deƒZG dd„ deƒZdd„ Zd	d
„ Z	dd„ Z
dS )z+
Test my automatically generate exceptions
é    )ÚJoblibExceptionÚJoblibNameErrorÚ_mk_exceptionc                   @   s   e Zd Zdd„ ZdS )ÚCustomExceptionc                 C   s    ||||f\| _ | _| _| _d S ©N)ÚaÚbÚcÚd)Úselfr   r   r	   r
   © r   úB/tmp/pip-unpacked-wheel-ho8k9mhl/joblib/test/test_my_exceptions.pyÚ__init__	   s    zCustomException.__init__N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r      s   r   c                   @   s   e Zd ZdZdd„ ZdS )ÚCustomException2zˆA custom exception with a .args attribute

    Just to check that the JoblibException created from it
    has it args set correctly
    c                 G   s   || _ || _d S r   )r   Úargs)r   r   r   r   r   r   r      s    zCustomException2.__init__N)r   r   r   Ú__doc__r   r   r   r   r   r      s   r   c                   C   s8   t tƒ tƒst‚t tƒ tƒs t‚tttƒd ks4t‚d S )Nr   )Ú
isinstancer   Ú	NameErrorÚAssertionErrorr   r   r   r   r   r   Útest_inheritance   s    r   c                  C   sZ   t tƒd tkst‚t tƒd tks(t‚tdd„ ƒtg} | D ]}t |ƒd tks<t‚q<d S )Nr   c                   S   s   d S r   r   r   r   r   r   Ú<lambda>+   ó    z0test_inheritance_special_cases.<locals>.<lambda>)r   Ú	Exceptionr   r   ÚtypeÚbool)Znon_inheritable_classesÚ	exceptionr   r   r   Útest_inheritance_special_cases   s
    r   c                  C   sz   t ttttttfD ]b} d}t| ƒd |dddddƒ}t|ƒ}t	|| ƒsJt
‚t	|tƒsXt
‚|jj|ksht
‚||kst
‚qd S )Nz,This message should be in the exception reprr   ZsomeÚotherr   zthat are notzin the repr)r   Ú	TypeErrorÚSyntaxErrorÚ
ValueErrorÚImportErrorr   r   r   Úreprr   r   r   Ú	__class__r   )ÚklassÚmessageÚexcZexc_reprr   r   r   Útest__mk_exception0   s&      ÿ
     ÿr*   N)r   Zjoblib.my_exceptionsr   r   r   r   r   r   r   r   r*   r   r   r   r   Ú<module>   s   