summaryrefslogtreecommitdiff
path: root/numpy/core/tests
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-08-12 18:24:06 -0700
committerCharles Harris <charlesr.harris@gmail.com>2013-08-12 18:24:06 -0700
commitfc800230de0d4e138e6088da4b2155559d0e710a (patch)
tree55d8cc0fac037577f2543dee1556216924b6607b /numpy/core/tests
parentdd2717f3b1a524c58b7bf79f234b87a6a9f68b2e (diff)
parentb2bfdae162452eaaaa6662a72dcd758169580ae1 (diff)
downloadnumpy-fc800230de0d4e138e6088da4b2155559d0e710a.tar.gz
Merge pull request #2893 from mwiebe/reduceat_empty
Reduceat regression fix
Diffstat (limited to 'numpy/core/tests')
-rw-r--r--numpy/core/tests/test_umath.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index c2304a748..b2d47d052 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -1263,6 +1263,21 @@ def test_reduceat():
np.setbufsize(np.UFUNC_BUFSIZE_DEFAULT)
assert_array_almost_equal(h1, h2)
+def test_reduceat_empty():
+ """Reduceat should work with empty arrays"""
+ indices = np.array([], 'i4')
+ x = np.array([], 'f8')
+ result = np.add.reduceat(x, indices)
+ assert_equal(result.dtype, x.dtype)
+ assert_equal(result.shape, (0,))
+ # Another case with a slightly different zero-sized shape
+ x = np.ones((5,2))
+ result = np.add.reduceat(x, [], axis=0)
+ assert_equal(result.dtype, x.dtype)
+ assert_equal(result.shape, (0, 2))
+ result = np.add.reduceat(x, [], axis=1)
+ assert_equal(result.dtype, x.dtype)
+ assert_equal(result.shape, (5, 0))
def test_complex_nan_comparisons():
nans = [complex(np.nan, 0), complex(0, np.nan), complex(np.nan, np.nan)]