summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index eda919df6..57bfee61b 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -1030,7 +1030,9 @@ class TestMeshgrid(TestCase):
assert_raises(ValueError, meshgrid, np.arange(5))
def test_indexing(self):
- [X, Y] = meshgrid([1, 2, 3], [4, 5, 6, 7], indexing='ij')
+ x = [1, 2, 3]
+ y = [4, 5, 6, 7]
+ [X, Y] = meshgrid(x, y, indexing='ij')
assert_(all(X == array([[1, 1, 1, 1],
[2, 2, 2, 2],
[3, 3, 3, 3]])))
@@ -1038,6 +1040,15 @@ class TestMeshgrid(TestCase):
[4, 5, 6, 7],
[4, 5, 6, 7]])))
+ # Test expected shapes:
+ z = [8, 9]
+ assert_(meshgrid(x, y)[0].shape == (4, 3))
+ assert_(meshgrid(x, y, indexing='ij')[0].shape == (3, 4))
+ assert_(meshgrid(x, y, z)[0].shape == (4, 3, 2))
+ assert_(meshgrid(x, y, z, indexing='ij')[0].shape == (3, 4, 2))
+
+ assert_raises(ValueError, meshgrid, x, y, indexing='notvalid')
+
def test_sparse(self):
[X, Y] = meshgrid([1, 2, 3], [4, 5, 6, 7], sparse=True)
assert_(all(X == array([[1, 2, 3]])))