def testHistogram(self): pda = ak.randint(10, 30, 40) result = ak.histogram(pda, bins=20) self.assertIsInstance(result, ak.pdarray) self.assertEqual(20, len(result)) self.assertEqual(int, result.dtype) with self.assertRaises(TypeError) as cm: ak.histogram([range(0, 10)], bins=1) self.assertEqual( 'type of argument "pda" must be arkouda.pdarrayclass.pdarray; got list instead', cm.exception.args[0]) with self.assertRaises(TypeError) as cm: ak.histogram(pda, bins='1') self.assertEqual( 'type of argument "bins" must be int; got str instead', cm.exception.args[0]) with self.assertRaises(TypeError) as cm: ak.histogram([range(0, 10)], bins='1') self.assertEqual( 'type of argument "pda" must be arkouda.pdarrayclass.pdarray; got list instead', cm.exception.args[0])
def testErrorHandling(self): # Test NotImplmentedError that prevents pddarray iteration with self.assertRaises(NotImplementedError): iter(ak.ones(100)) # Test NotImplmentedError that prevents Strings iteration with self.assertRaises(NotImplementedError): iter(ak.array(['String {}'.format(i) for i in range(0, 10)])) # Test ak,histogram against unsupported dtype with self.assertRaises(ValueError): ak.histogram((ak.randint(0, 1, 100, dtype=ak.bool))) with self.assertRaises(RuntimeError) as cm: ak.concatenate([ak.array([True]), ak.array([True])]).is_sorted() self.assertEqual('Error: reductionMsg: is_sorted bool not implemented', cm.exception.args[0]) with self.assertRaises(TypeError): ak.ones(100).any([0])