diff options
author | Joscha Reimer <jor@informatik.uni-kiel.de> | 2018-07-30 10:37:51 +0200 |
---|---|---|
committer | Joscha Reimer <jor@informatik.uni-kiel.de> | 2018-07-30 10:37:51 +0200 |
commit | a87168023f0e99e2481c62855f2e14f4653a1a46 (patch) | |
tree | 4cd71cbff010615a3306aa6bb72108a17014a3a2 /numpy | |
parent | 878bad2320910a24335401b37415c50442825ae6 (diff) | |
download | numpy-a87168023f0e99e2481c62855f2e14f4653a1a46.tar.gz |
API: isposinf and isneginf now raise TypeError instead of ValueError for complex values
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/lib/tests/test_ufunclike.py | 4 | ||||
-rw-r--r-- | numpy/lib/ufunclike.py | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/numpy/lib/tests/test_ufunclike.py b/numpy/lib/tests/test_ufunclike.py index 7c41ed1a3..889ee77e3 100644 --- a/numpy/lib/tests/test_ufunclike.py +++ b/numpy/lib/tests/test_ufunclike.py @@ -22,7 +22,7 @@ class TestUfunclike(object): assert_equal(out, tgt) a = a.astype(np.complex) - with assert_raises(ValueError): + with assert_raises(TypeError): ufl.isposinf(a) def test_isneginf(self): @@ -37,7 +37,7 @@ class TestUfunclike(object): assert_equal(out, tgt) a = a.astype(np.complex) - with assert_raises(ValueError): + with assert_raises(TypeError): ufl.isneginf(a) def test_fix(self): diff --git a/numpy/lib/ufunclike.py b/numpy/lib/ufunclike.py index 6c6f0a056..4d21cb820 100644 --- a/numpy/lib/ufunclike.py +++ b/numpy/lib/ufunclike.py @@ -141,8 +141,8 @@ def isposinf(x, out=None): """ x = nx.asanyarray(x) if nx.issubdtype(x.dtype, nx.complexfloating): - raise ValueError('This operation is not supported for complex values' - 'because it would be ambiguous.') + raise TypeError('This operation is not supported for complex values ' + 'because it would be ambiguous.') return nx.logical_and(nx.isinf(x), ~nx.signbit(x), out) @@ -207,6 +207,6 @@ def isneginf(x, out=None): """ x = nx.asanyarray(x) if nx.issubdtype(x.dtype, nx.complexfloating): - raise ValueError('This operation is not supported for complex values' - 'because it would be ambiguous.') + raise TypeError('This operation is not supported for complex values ' + 'because it would be ambiguous.') return nx.logical_and(nx.isinf(x), nx.signbit(x), out) |