summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2010-04-14 17:24:50 +0000
committerCharles Harris <charlesr.harris@gmail.com>2010-04-14 17:24:50 +0000
commitfcc0b79de4ae35548dbc711c9273ecd875764ccd (patch)
treecd062b0a5307645101f16082ea9261c5af2acc15
parent6ec10208ea799f417b612273485e081b5b07eb21 (diff)
downloadnumpy-fcc0b79de4ae35548dbc711c9273ecd875764ccd.tar.gz
BUG: Use deprecated decorator in testing ufunclike.log2.
-rw-r--r--numpy/lib/tests/test_ufunclike.py17
-rw-r--r--numpy/lib/ufunclike.py3
2 files changed, 9 insertions, 11 deletions
diff --git a/numpy/lib/tests/test_ufunclike.py b/numpy/lib/tests/test_ufunclike.py
index f2712612e..00c81bf43 100644
--- a/numpy/lib/tests/test_ufunclike.py
+++ b/numpy/lib/tests/test_ufunclike.py
@@ -1,7 +1,7 @@
from numpy.testing import *
import numpy.core as nx
import numpy.lib.ufunclike as ufl
-import warnings
+from numpy.testing.decorators import deprecated
class TestUfunclike(TestCase):
@@ -27,19 +27,16 @@ class TestUfunclike(TestCase):
assert_equal(res, tgt)
assert_equal(out, tgt)
+ @deprecated()
def test_log2(self):
a = nx.array([4.5, 2.3, 6.5])
out = nx.zeros(a.shape, float)
tgt = nx.array([2.169925, 1.20163386, 2.70043972])
- try:
- warnings.filterwarnings("ignore",category=DeprecationWarning)
- res = ufl.log2(a)
- assert_almost_equal(res, tgt)
- res = ufl.log2(a, out)
- assert_almost_equal(res, tgt)
- assert_almost_equal(out, tgt)
- except DeprecationWarning:
- pass
+ res = ufl.log2(a)
+ assert_almost_equal(res, tgt)
+ res = ufl.log2(a, out)
+ assert_almost_equal(res, tgt)
+ assert_almost_equal(out, tgt)
def test_fix(self):
a = nx.array([[1.0, 1.1, 1.5, 1.8], [-1.0, -1.1, -1.5, -1.8]])
diff --git a/numpy/lib/ufunclike.py b/numpy/lib/ufunclike.py
index acd46010e..734fd08be 100644
--- a/numpy/lib/ufunclike.py
+++ b/numpy/lib/ufunclike.py
@@ -5,7 +5,6 @@ storing results in an output array.
__all__ = ['fix', 'isneginf', 'isposinf']
import numpy.core.numeric as nx
-import warnings
def fix(x, y=None):
"""
@@ -174,6 +173,7 @@ def isneginf(x, y=None):
nx.logical_and(nx.isinf(x), nx.signbit(x), y)
return y
+
_log2 = nx.log(2)
def log2(x, y=None):
"""
@@ -203,6 +203,7 @@ def log2(x, y=None):
array([ NaN, 1., 2.])
"""
+ import warnings
msg = "numpy.lib.log2 is deprecated, use np.log2 instead."
warnings.warn(msg, DeprecationWarning)