summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorJay Bourque <jay.bourque@continuum.io>2012-11-15 15:09:04 -0600
committerJay Bourque <jay.bourque@continuum.io>2013-08-16 16:39:30 -0500
commita8d13b86eeca2e9362219aabca0ff76717f6a2f3 (patch)
tree4b52695ddebe6a7c85e5770ea53991dd0ea9065d /numpy
parentcf9452f52e3d3be3df81f85ee744811c78140faf (diff)
downloadnumpy-a8d13b86eeca2e9362219aabca0ff76717f6a2f3.tar.gz
Add more unit tests for 'at' method
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/umath/ufunc_object.c2
-rw-r--r--numpy/core/tests/test_ufunc.py6
2 files changed, 6 insertions, 2 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index a038982ba..9c26692a7 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -5001,8 +5001,6 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args, PyObject *kwds)
fail:
- if (op1_array != NULL)
- Py_DECREF(op1_array);
if (op2_array != NULL)
Py_DECREF(op2_array);
if (iter != NULL)
diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py
index d58b20d38..5b3b1ce02 100644
--- a/numpy/core/tests/test_ufunc.py
+++ b/numpy/core/tests/test_ufunc.py
@@ -943,6 +943,12 @@ class TestUfunc(TestCase):
np.negative.at(a, [2,5,2])
assert_equal(a, [0, 1, 2, 3, 4, -5, 6, 7, 8, 9])
+ # test exception when indices dimensions < first operand dimensions
+ a = np.arange(27).reshape(3,3,3)
+ b = np.array([100,200,300])
+ assert_raises(ValueError, np.add.at, a, [1,2,1], b)
+ assert_raises(ValueError, np.add.at, a, ([1,2,1],), b)
+
if __name__ == "__main__":
run_module_suite()