summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_index_tricks.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/tests/test_index_tricks.py')
-rw-r--r--numpy/lib/tests/test_index_tricks.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py
index 1020d4f82..3cfed1059 100644
--- a/numpy/lib/tests/test_index_tricks.py
+++ b/numpy/lib/tests/test_index_tricks.py
@@ -1,5 +1,12 @@
from numpy.testing import *
-from numpy import array, ones, r_, mgrid
+from numpy import array, ones, r_, mgrid, unravel_index
+
+class TestUnravelIndex(TestCase):
+ def test_basic(self):
+ assert unravel_index(2,(2,2)) == (1,0)
+ assert unravel_index(254,(17,94)) == (2, 66)
+ assert_raises(ValueError, unravel_index, 4,(2,2))
+
class TestGrid(TestCase):
def test_basic(self):
@@ -26,6 +33,7 @@ class TestGrid(TestCase):
assert_array_almost_equal(d[0,1,:]-d[0,0,:], 0.1*ones(20,'d'),11)
assert_array_almost_equal(d[1,:,1]-d[1,:,0], 0.2*ones(20,'d'),11)
+
class TestConcatenator(TestCase):
def test_1d(self):
assert_array_equal(r_[1,2,3,4,5,6],array([1,2,3,4,5,6]))