diff options
author | Saransh <saransh0701@gmail.com> | 2022-07-14 14:10:46 +0530 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2022-09-07 11:17:38 -0600 |
commit | fc0d62795a2228afd442703324e29ed10898061a (patch) | |
tree | a120e463759aa6323dd0b9ff1372cea2306c8c64 | |
parent | e18dd98ca72441f3eead9c974550ccd75b2247dd (diff) | |
download | numpy-fc0d62795a2228afd442703324e29ed10898061a.tar.gz |
TST: ensure `np.equal.reduce` raises a `TypeError`
-rw-r--r-- | numpy/core/tests/test_umath.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index f12307e30..4160dc9b1 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -226,6 +226,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): |