diff options
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/tests/test_index_tricks.py | 8 | ||||
-rw-r--r-- | numpy/lib/tests/test_regression.py | 4 |
2 files changed, 11 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() diff --git a/numpy/lib/tests/test_regression.py b/numpy/lib/tests/test_regression.py index b8c487962..5abf9aefe 100644 --- a/numpy/lib/tests/test_regression.py +++ b/numpy/lib/tests/test_regression.py @@ -48,6 +48,10 @@ class TestRegression(object): """Ticket 928.""" assert_raises(ValueError, np.histogramdd, np.ones((1,10)), bins=2**10) + def test_ndenumerate_crash(self): + """Ticket 1140""" + # Shouldn't crash: + list(np.ndenumerate(np.array([[]]))) if __name__ == "__main__": run_module_suite() |