def testCos(self): na = np.linspace(1,10,10) pda = ak.array(na) self.assertTrue((np.cos(na) == ak.cos(pda).to_ndarray()).all()) with self.assertRaises(TypeError) as cm: ak.cos([range(0,10)]) self.assertEqual('type of argument "pda" must be arkouda.pdarrayclass.pdarray; got list instead', cm.exception.args[0])
def testCos(self): pda = ak.linspace(1,10,10) result = ak.cos(pda) self.assertIsInstance(result, ak.pdarray) self.assertEqual(10, len(result)) self.assertEqual(float, result.dtype) with self.assertRaises(TypeError) as cm: ak.cos([range(0,10)]) self.assertEqual('type of argument "pda" must be arkouda.pdarrayclass.pdarray; got list instead', cm.exception.args[0])
def test_error_handling(self): with self.assertRaises(RuntimeError) as cm: ak.concatenate([ak.ones(100), ak.array([True])]) self.assertEqual( 'Error: concatenateMsg: Incompatible arguments: ' + 'Expected float64 dtype but got bool dtype', cm.exception.args[0]) with self.assertRaises(TypeError): ak.union1d([-1, 0, 1], [-2, 0, 2]) with self.assertRaises(RuntimeError) as cm: ak.cos(ak.randint(0, 1, 100, dtype=ak.bool)) self.assertEqual('Error: efuncMsg: cos bool not implemented', cm.exception.args[0])