diff options
author | pierregm <pierregmcode@gmail.com> | 2010-10-11 23:02:10 +0200 |
---|---|---|
committer | pierregm <pierregmcode@gmail.com> | 2010-10-11 23:02:10 +0200 |
commit | a14dd542532d383610c1b01c5698b137dd058fea (patch) | |
tree | 036f0452ee16fe1b9b74c13e6ad9bb9155310256 /numpy/lib/tests/test_index_tricks.py | |
parent | 61d945bdb5c9b2b3329e1b8468b5c7d0596dd9fc (diff) | |
parent | 11ee694744f2552d77652ed929fdc2b4ccca6843 (diff) | |
download | numpy-a14dd542532d383610c1b01c5698b137dd058fea.tar.gz |
merging refs/remotes/origin/master into HEAD
Diffstat (limited to 'numpy/lib/tests/test_index_tricks.py')
-rw-r--r-- | numpy/lib/tests/test_index_tricks.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py index 3307cef3e..c17ee5d6a 100644 --- a/numpy/lib/tests/test_index_tricks.py +++ b/numpy/lib/tests/test_index_tricks.py @@ -2,7 +2,7 @@ from numpy.testing import * import numpy as np from numpy import ( array, ones, r_, mgrid, unravel_index, zeros, where, ndenumerate, fill_diagonal, diag_indices, - diag_indices_from ) + diag_indices_from, s_, index_exp ) class TestUnravelIndex(TestCase): def test_basic(self): @@ -77,6 +77,19 @@ class TestNdenumerate(TestCase): [((0,0), 1), ((0,1), 2), ((1,0), 3), ((1,1), 4)]) +class TestIndexExpression(TestCase): + def test_regression_1(self): + # ticket #1196 + a = np.arange(2) + assert_equal(a[:-1], a[s_[:-1]]) + assert_equal(a[:-1], a[index_exp[:-1]]) + + def test_simple_1(self): + a = np.random.rand(4,5,6) + + assert_equal(a[:,:3,[1,2]], a[index_exp[:,:3,[1,2]]]) + assert_equal(a[:,:3,[1,2]], a[s_[:,:3,[1,2]]]) + def test_fill_diagonal(): a = zeros((3, 3),int) fill_diagonal(a, 5) |