a
    feza  ã                   @   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   ú=lib/python3.9/site-packages/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J ‚t tƒ tƒs J ‚tttƒd u s4J ‚d S )Nr   )Ú
isinstancer   Ú	NameErrorr   r   r   r   r   r   Útest_inheritance   s    r   c                  C   sZ   t tƒd tu sJ ‚t tƒd tu s(J ‚tdd„ ƒtg} | D ]}t |ƒd tu s<J ‚q<d S )Nr   c                   S   s   d S r   r   r   r   r   r   Ú<lambda>+   ó    z0test_inheritance_special_cases.<locals>.<lambda>)r   Ú	Exceptionr   Ú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	|| ƒsJJ ‚t	|t
ƒsXJ ‚|jj|v shJ ‚||v sJ ‚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   Ú	__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   