From ffb8c414875a1430814c1e9938d1a58defcf516d Mon Sep 17 00:00:00 2001 From: Jay Bourque Date: Wed, 9 Jan 2013 09:29:54 -0600 Subject: Add test for optional size argument for ndindex --- numpy/lib/tests/test_index_tricks.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'numpy/lib/tests/test_index_tricks.py') diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py index 0ede40d5a..61197af4f 100644 --- a/numpy/lib/tests/test_index_tricks.py +++ b/numpy/lib/tests/test_index_tricks.py @@ -242,6 +242,10 @@ def test_ndindex(): expected = [ix for ix, e in np.ndenumerate(np.zeros((1, 2, 3)))] assert_array_equal(x, expected) + # Make sure size argument is optional + x = list(np.ndindex()) + assert_equal(x, [(0,)]) + if __name__ == "__main__": run_module_suite() -- cgit v1.2.1 From dd146b6929f79fd6af27528dd4370eaebd5c57a6 Mon Sep 17 00:00:00 2001 From: "Travis E. Oliphant" Date: Thu, 10 Jan 2013 00:26:34 -0600 Subject: Fix the test for numpy.ndindex() --- numpy/lib/tests/test_index_tricks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/tests/test_index_tricks.py') diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py index 61197af4f..3cb06b4fb 100644 --- a/numpy/lib/tests/test_index_tricks.py +++ b/numpy/lib/tests/test_index_tricks.py @@ -244,7 +244,7 @@ def test_ndindex(): # Make sure size argument is optional x = list(np.ndindex()) - assert_equal(x, [(0,)]) + assert_equal(x, [()]) if __name__ == "__main__": -- cgit v1.2.1 From aef2cf73aafc9a945d88cb9464f62135b177a2f4 Mon Sep 17 00:00:00 2001 From: "Travis E. Oliphant" Date: Thu, 10 Jan 2013 00:26:34 -0600 Subject: Fix the test for numpy.ndindex() Fix ndindex for 0-d arrays. Add tests for tuple arguments to ndindex --- numpy/lib/tests/test_index_tricks.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'numpy/lib/tests/test_index_tricks.py') diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py index 3cb06b4fb..43160ffb7 100644 --- a/numpy/lib/tests/test_index_tricks.py +++ b/numpy/lib/tests/test_index_tricks.py @@ -242,10 +242,16 @@ def test_ndindex(): expected = [ix for ix, e in np.ndenumerate(np.zeros((1, 2, 3)))] assert_array_equal(x, expected) + x = list(np.ndindex((1, 2, 3))) + assert_array_equal(x, expected) + # Make sure size argument is optional x = list(np.ndindex()) assert_equal(x, [()]) + x = list(np.ndindex(())) + assert_equal(x, [()]) + if __name__ == "__main__": run_module_suite() -- cgit v1.2.1