diff options
| author | Saransh <saransh0701@gmail.com> | 2022-07-14 14:10:46 +0530 |
|---|---|---|
| committer | Sebastian Berg <sebastian@sipsolutions.net> | 2022-08-05 08:07:05 +0530 |
| commit | f4f7595e99fffffe15effdaefe12cb7ef686ec6f (patch) | |
| tree | e9091e80c71672329c4e1d675fe590fdfd4d3963 | |
| parent | 918065167a3860c97d52d6292f206101d660be6f (diff) | |
| download | numpy-f4f7595e99fffffe15effdaefe12cb7ef686ec6f.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 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): |
