summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaransh <saransh0701@gmail.com>2022-07-14 14:10:46 +0530
committerSebastian Berg <sebastian@sipsolutions.net>2022-08-05 08:07:05 +0530
commitf4f7595e99fffffe15effdaefe12cb7ef686ec6f (patch)
treee9091e80c71672329c4e1d675fe590fdfd4d3963
parent918065167a3860c97d52d6292f206101d660be6f (diff)
downloadnumpy-f4f7595e99fffffe15effdaefe12cb7ef686ec6f.tar.gz
TST: ensure `np.equal.reduce` raises a `TypeError`
-rw-r--r--numpy/core/tests/test_umath.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index a696fceb8..2accb6386 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -267,6 +267,14 @@ class TestComparisons:
a = np.array([np.nan], dtype=object)
assert_equal(np.not_equal(a, a), [True])
+ def test_error_in_equal_reduce(self):
+ # gh-20929
+ # make sure np.equal.reduce raises a TypeError if an array is passed
+ # without specifying the dtype
+ a = np.array([0, 0])
+ assert_equal(np.equal.reduce(a, dtype=bool), True)
+ assert_raises(TypeError, np.equal.reduce, a)
+
class TestAdd:
def test_reduce_alignment(self):