diff options
Diffstat (limited to 'numpy/lib/tests/test_index_tricks.py')
-rw-r--r-- | numpy/lib/tests/test_index_tricks.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py index fc3b90900..0e3c98ee1 100644 --- a/numpy/lib/tests/test_index_tricks.py +++ b/numpy/lib/tests/test_index_tricks.py @@ -171,17 +171,21 @@ class TestIndexExpression(TestCase): class TestIx_(TestCase): def test_regression_1(self): - # Empty inputs create ouputs of indexing type, gh-5804 - a, = np.ix_(range(0, 0)) - assert_equal(a.dtype, np.intp) + # Test empty inputs create ouputs of indexing type, gh-5804 + # Test both lists and arrays + for func in (range, np.arange): + a, = np.ix_(func(0)) + assert_equal(a.dtype, np.intp) def test_shape_and_dtype(self): sizes = (4, 5, 3, 2) - arrays = np.ix_(*[range(sz) for sz in sizes]) - for k, (a, sz) in enumerate(zip(arrays, sizes)): - assert_equal(a.shape[k], sz) - assert_(all(sh == 1 for j, sh in enumerate(a.shape) if j != k)) - assert_(np.issubdtype(a.dtype, int)) + # Test both lists and arrays + for func in (range, np.arange): + arrays = np.ix_(*[func(sz) for sz in sizes]) + for k, (a, sz) in enumerate(zip(arrays, sizes)): + assert_equal(a.shape[k], sz) + assert_(all(sh == 1 for j, sh in enumerate(a.shape) if j != k)) + assert_(np.issubdtype(a.dtype, int)) def test_bool(self): bool_a = [True, False, True, True] |