summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_index_tricks.py
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2009-06-19 13:01:20 +0000
committerPauli Virtanen <pav@iki.fi>2009-06-19 13:01:20 +0000
commit6cfb1c6c4ef9b5d44ada70d94f1573c8f964c3ac (patch)
tree7f6b41f4fa86a8809144b2c64f3c7a68f705950b /numpy/lib/tests/test_index_tricks.py
parentee57730721f7b101cb9477be50a3d1bb255ebf06 (diff)
downloadnumpy-6cfb1c6c4ef9b5d44ada70d94f1573c8f964c3ac.tar.gz
Fixed #1140: avoid div-by-zero in iter_coords_get for size=0 arrays
Diffstat (limited to 'numpy/lib/tests/test_index_tricks.py')
-rw-r--r--numpy/lib/tests/test_index_tricks.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py
index 47529502d..641737d43 100644
--- a/numpy/lib/tests/test_index_tricks.py
+++ b/numpy/lib/tests/test_index_tricks.py
@@ -1,5 +1,5 @@
from numpy.testing import *
-from numpy import array, ones, r_, mgrid, unravel_index
+from numpy import array, ones, r_, mgrid, unravel_index, ndenumerate
class TestUnravelIndex(TestCase):
def test_basic(self):
@@ -62,5 +62,11 @@ class TestConcatenator(TestCase):
assert_array_equal(d[5:,:],c)
+class TestNdenumerate(TestCase):
+ def test_basic(self):
+ a = array([[1,2], [3,4]])
+ assert_equal(list(ndenumerate(a)),
+ [((0,0), 1), ((0,1), 2), ((1,0), 3), ((1,1), 4)])
+
if __name__ == "__main__":
run_module_suite()