summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2023-01-03 11:41:30 +0200
committermattip <matti.picus@gmail.com>2023-01-03 11:41:30 +0200
commit217e2a7086a30bd0cf1f2fe84ae6b6e0ee7dc7c9 (patch)
treea2902682f8e92cd404c6381d29d18ebea1d78db5
parentaf52e197a16b136ea863a5f7e2e078404c30229b (diff)
downloadnumpy-217e2a7086a30bd0cf1f2fe84ae6b6e0ee7dc7c9.tar.gz
MAINT: improve coverage of slow path by using a user-defined dtype
-rw-r--r--numpy/core/tests/test_ufunc.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py
index 00aa48647..b228c441c 100644
--- a/numpy/core/tests/test_ufunc.py
+++ b/numpy/core/tests/test_ufunc.py
@@ -1923,12 +1923,19 @@ class TestUfunc:
assert_(MyThing.rmul_count == 1, MyThing.rmul_count)
assert_(MyThing.getitem_count <= 2, MyThing.getitem_count)
- def test_inplace_fancy_indexing(self):
+ @pytest.mark.parametrize("a", (
+ np.arange(10, dtype=int),
+ np.arange(10, dtype=_rational_tests.rational),
- a = np.arange(10)
+ ))
+ def test_inplace_fancy_indexing(self, a):
np.add.at(a, [2, 5, 2], 1)
assert_equal(a, [0, 1, 4, 3, 4, 6, 6, 7, 8, 9])
+ np.negative.at(a, [2, 5, 3])
+ assert_equal(a, [0, 1, -4, -3, 4, -6, 6, 7, 8, 9])
+
+ # reset a
a = np.arange(10)
b = np.array([100, 100, 100])
np.add.at(a, [2, 5, 2], b)