diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2021-08-09 16:59:21 -0500 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2021-10-11 19:32:34 -0500 |
commit | 3ce020dd1465b055555b957b30115912def68e3f (patch) | |
tree | ef8cde40f0bba51df1ce35031a43d22d07655873 | |
parent | a8262a5a87835fcb8b64334334b3eca93a2ab8d5 (diff) | |
download | numpy-3ce020dd1465b055555b957b30115912def68e3f.tar.gz |
TST: Add test for ufunc out-cast failure when input cast is ignored
-rw-r--r-- | numpy/core/tests/test_ufunc.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py index 0a94a6dc8..fe0b07c6b 100644 --- a/numpy/core/tests/test_ufunc.py +++ b/numpy/core/tests/test_ufunc.py @@ -2124,6 +2124,16 @@ class TestUfunc: assert_array_equal(ufunc(a, c), ufunc([True, True], True)) assert ufunc.reduce(a) == True + @pytest.mark.parametrize("ufunc", + [np.logical_and, np.logical_or, np.logical_xor]) + def test_logical_ufuncs_out_cast_check(self, ufunc): + a = np.array('1') + c = np.array([1., 2.]) + out = a.copy() + with pytest.raises(TypeError): + # It would be safe, but not equiv casting: + ufunc(a, c, out=out, casting="equiv") + def test_reduce_noncontig_output(self): # Check that reduction deals with non-contiguous output arrays # appropriately. |