<s> import unittest <EOL> from cupy import testing <EOL> @ testing . gpu <EOL> class TestArithmetic ( unittest . TestCase ) : <EOL> _multiprocess_can_split_ = True <EOL> @ testing . for_all_dtypes ( ) <EOL> @ testing . numpy_cupy_allclose ( atol = <NUM_LIT> ) <EOL> def check_unary ( self , name , xp , dtype ) : <EOL> a = testing . shaped_arange ( ( <NUM_LIT:2> , <NUM_LIT:3> ) , xp , dtype ) <EOL> return getattr ( xp , name ) ( a ) <EOL> @ testing . for_all_dtypes ( ) <EOL> @ testing . numpy_cupy_allclose ( atol = <NUM_LIT> ) <EOL> def check_binary ( self , name , xp , dtype ) : <EOL> a = testing . shaped_arange ( ( <NUM_LIT:2> , <NUM_LIT:3> ) , xp , dtype ) <EOL> b = testing . shaped_reverse_arange ( ( <NUM_LIT:2> , <NUM_LIT:3> ) , xp , dtype ) <EOL> return getattr ( xp , name ) ( a , b ) <EOL> @ testing . for_dtypes ( [ '<STR_LIT:?>' , '<STR_LIT:b>' , '<STR_LIT:h>' , '<STR_LIT:i>' , '<STR_LIT:q>' , '<STR_LIT:e>' , '<STR_LIT:f>' , '<STR_LIT:d>' ] ) <EOL> @ testing . numpy_cupy_allclose ( atol = <NUM_LIT> ) <EOL> def check_unary_negative ( self , name , xp , dtype ) : <EOL> a = xp . array ( [ - <NUM_LIT:3> , - <NUM_LIT:2> , - <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , dtype = dtype ) <EOL> return getattr ( xp , name ) ( a ) <EOL> @ testing . for_dtypes ( [ '<STR_LIT:?>' , '<STR_LIT:b>' , '<STR_LIT:h>' , '<STR_LIT:i>' , '<STR_LIT:q>' , '<STR_LIT:e>' , '<STR_LIT:f>' , '<STR_LIT:d>' ] ) <EOL> @ testing . numpy_cupy_allclose ( atol = <NUM_LIT> ) <EOL> def check_binary_negative ( self , name , xp , dtype ) : <EOL> a = xp . array ( [ - <NUM_LIT:3> , - <NUM_LIT:2> , - <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , dtype = dtype ) <EOL> b = xp . array ( [ <NUM_LIT:4> , <NUM_LIT:3> , <NUM_LIT:2> , <NUM_LIT:1> , - <NUM_LIT:1> , - <NUM_LIT:2> ] , dtype = dtype ) <EOL> return getattr ( xp , name ) ( a , b ) <EOL> def test_add ( self ) : <EOL> self . check_binary ( '<STR_LIT>' ) <EOL> def test_reciprocal ( self ) : <EOL> with testing . NumpyError ( divide = '<STR_LIT:ignore>' , invalid = '<STR_LIT:ignore>' ) : <EOL> self . check_unary ( '<STR_LIT>' ) <EOL> def test_multiply ( self ) : <EOL> self . check_binary ( '<STR_LIT>' ) <EOL> def test_divide ( self ) : <EOL> with testing . NumpyError ( divide = '<STR_LIT:ignore>' ) : <EOL> self . check_binary ( '<STR_LIT>' ) <EOL> def test_divide_negative ( self ) : <EOL> with testing . NumpyError ( divide = '<STR_LIT:ignore>' ) : <EOL> self . check_binary_negative ( '<STR_LIT>' ) <EOL> def test_power ( self ) : <EOL> self . check_binary ( '<STR_LIT>' ) <EOL> def test_power_negative ( self ) : <EOL> self . check_binary_negative ( '<STR_LIT>' ) <EOL> def test_subtract ( self ) : <EOL> self . check_binary ( '<STR_LIT>' ) <EOL> def test_true_divide ( self ) : <EOL> with testing . NumpyError ( divide = '<STR_LIT:ignore>' ) : <EOL> self . check_binary ( '<STR_LIT>' ) <EOL> def test_true_divide_negative ( self ) : <EOL> with testing . NumpyError ( divide = '<STR_LIT:ignore>' ) : <EOL> self . check_binary_negative ( '<STR_LIT>' ) <EOL> def test_floor_divide ( self ) : <EOL> with testing . NumpyError ( divide = '<STR_LIT:ignore>' ) : <EOL> self . check_binary ( '<STR_LIT>' ) <EOL> def test_floor_divide_negative ( self ) : <EOL> with testing . NumpyError ( divide = '<STR_LIT:ignore>' ) : <EOL> self . check_binary_negative ( '<STR_LIT>' ) <EOL> def test_fmod ( self ) : <EOL> with testing . NumpyError ( divide = '<STR_LIT:ignore>' ) : <EOL> self . check_binary ( '<STR_LIT>' ) <EOL> def test_fmod_negative ( self ) : <EOL> with testing . NumpyError ( divide = '<STR_LIT:ignore>' ) : <EOL> self . check_binary_negative ( '<STR_LIT>' ) <EOL> @ testing . for_float_dtypes ( ) <EOL> @ testing . numpy_cupy_allclose ( ) <EOL> def test_modf ( self , xp , dtype ) : <EOL> a = xp . array ( [ - <NUM_LIT> , - <NUM_LIT> , - <NUM_LIT:0.5> , <NUM_LIT:0> , <NUM_LIT:0.5> , <NUM_LIT> , <NUM_LIT> ] , dtype = dtype ) <EOL> b , c = xp . modf ( a ) <EOL> d = xp . empty ( ( <NUM_LIT:2> , <NUM_LIT:7> ) , dtype = dtype ) <EOL> d [ <NUM_LIT:0> ] = b <EOL> d [ <NUM_LIT:1> ] = c <EOL> return d <EOL> def test_remainder ( self ) : <EOL> with testing . NumpyError ( divide = '<STR_LIT:ignore>' ) : <EOL> self . check_binary ( '<STR_LIT>' ) <EOL> def test_remainder_negative ( self ) : <EOL> with testing . NumpyError ( divide = '<STR_LIT:ignore>' ) : <EOL> self . check_binary_negative ( '<STR_LIT>' ) </s>
