U
    d                     @   s&   d dl Z d dlZG dd de jZdS )    Nc                   @   s&   e Zd Zdd Zd	ddZdd ZdS )
TestCasec                 C   s   t jjdd d S )Nr   )seed)nprandomr   )self r   G/tmp/pip-unpacked-wheel-ua33x9lu/caffe2/python/onnx/tests/test_utils.pysetUp   s    zTestCase.setUp   c                 C   sN   |  t|t| t||D ]*\}}|  |j|j tjj|||d qd S )N)decimal)assertEquallenzipZdtyper   ZtestingZassert_almost_equal)r   Zoutputs1Zoutputs2r   Zo1Zo2r   r   r   assertSameOutputs   s    zTestCase.assertSameOutputsc                 C   s@   | dstd|t| |r0td|t| || d S )NZtest_z#Test name must start with test_: {}zDuplicated test name: {})
startswith
ValueErrorformathasattrsetattr)r   nameZ	test_funcr   r   r   add_test_case   s
    

zTestCase.add_test_caseN)r
   )__name__
__module____qualname__r	   r   r   r   r   r   r   r      s   
r   )ZunittestZnumpyr   r   r   r   r   r   <module>	   s   