237
237
for func in ['copy', 'ones_like', 'sqrt',
238
238
'sin', 'cos', 'tan', 'arcsin', 'arccos', 'arctan',
239
239
'sinh', 'cosh', 'tanh', 'arcsinh', 'arccosh', 'arctanh',
240
'log', 'log1p', 'log10', 'exp', 'expm1']:
240
'log', 'log1p', 'log10', 'exp', 'expm1', 'abs']:
241
241
func1tests.append("a + %s(b+c)" % func)
242
242
tests.append(('1-ARG FUNCS', func1tests))
377
377
assert_array_equal(respy, resnx)
378
378
self.assertEqual(resnx.dtype.name, 'int64')
381
class test_uint32_int64(TestCase):
382
def test_small_uint32(self):
383
# Small uint32 should not be downgraded to ints.
386
assert_array_equal(res, 42)
387
self.assertEqual(res.dtype.name, 'int64')
389
def test_uint32_constant_promotion(self):
390
int32array = arange(100, dtype='int32')
393
res32 = evaluate('int32array * 2')
394
res64 = evaluate('int32array * a')
395
assert_array_equal(res, res32)
396
assert_array_equal(res, res64)
397
self.assertEqual(res32.dtype.name, 'int32')
398
self.assertEqual(res64.dtype.name, 'int64')
400
def test_int64_array_promotion(self):
401
uint32array = arange(100, dtype='uint32')
402
int64array = arange(100, dtype='int64')
403
respy = uint32array * int64array
404
resnx = evaluate('uint32array * int64array')
405
assert_array_equal(respy, resnx)
406
self.assertEqual(resnx.dtype.name, 'int64')
380
409
class test_strings(TestCase):
381
410
BLOCK_SIZE1 = 128
532
561
theSuite.addTest(unittest.makeSuite(test_evaluate))
533
562
theSuite.addTest(unittest.makeSuite(test_expressions))
534
563
theSuite.addTest(unittest.makeSuite(test_int32_int64))
564
theSuite.addTest(unittest.makeSuite(test_uint32_int64))
535
565
theSuite.addTest(unittest.makeSuite(test_strings))
536
566
theSuite.addTest(
537
567
unittest.makeSuite(test_irregular_stride) )