summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_index_tricks.py
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2009-07-04 12:14:59 +0000
committerStefan van der Walt <stefan@sun.ac.za>2009-07-04 12:14:59 +0000
commitae6da8374a055b5dfe738c03c41ff8e001f51180 (patch)
tree1c041e2f94fc9d4f23b23a88c448959da2778ac4 /numpy/lib/tests/test_index_tricks.py
parent99df3daf134808115b458d90c4c6fa676a02e6f2 (diff)
downloadnumpy-ae6da8374a055b5dfe738c03c41ff8e001f51180.tar.gz
Fix diag_indices_from and add test.
Diffstat (limited to 'numpy/lib/tests/test_index_tricks.py')
-rw-r--r--numpy/lib/tests/test_index_tricks.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py
index afa94396a..d7e61799a 100644
--- a/numpy/lib/tests/test_index_tricks.py
+++ b/numpy/lib/tests/test_index_tricks.py
@@ -1,4 +1,5 @@
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 )
@@ -112,6 +113,12 @@ def test_diag_indices():
[[0, 0],
[0, 1]]]) )
+def test_diag_indices_from():
+ x = np.random.random((4, 4))
+ r, c = diag_indices_from(x)
+ assert_array_equal(r, np.arange(4))
+ assert_array_equal(c, np.arange(4))
+
if __name__ == "__main__":
run_module_suite()