def testArray(self): f = ufunc_mod.UnaryCallable() a = numpy.arange(5, dtype=float) b = f(a) assert_array_almost_equal(b, a*2.0) c = numpy.zeros(5, dtype=float) d = f(a,output=c) self.assert_(c is d) assert_array_almost_equal(d, a*2.0)
def testList(self): f = ufunc_mod.UnaryCallable() a = range(5) b = f(a) assert_array_almost_equal(b/2.0, a)
def testScalar(self): f = ufunc_mod.UnaryCallable() assert_array_almost_equal(f(1.0), 2.0) assert_array_almost_equal(f(3.0), 6.0)