From e37a90c8bd1bf99f89b537ce47492095d6ae147c Mon Sep 17 00:00:00 2001 From: "Per A. Brodtkorb" Date: Tue, 13 Dec 2011 23:01:22 +0100 Subject: ENH: enhance meshgrid to generate 3D grids, sparse grids, matrix indexing. --- numpy/lib/tests/test_function_base.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'numpy/lib/tests') diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index ba6b336ff..af85be326 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1025,6 +1025,24 @@ class TestMeshgrid(TestCase): [5, 5, 5], [6, 6, 6], [7, 7, 7]]))) + def test_indexing(self): + [X, Y] = meshgrid([1, 2, 3], [4, 5, 6, 7], indexing='ij') + assert_(all(X == array([[1, 1, 1, 1], + [2, 2, 2, 2], + [3, 3, 3, 3]]))) + assert_(all(Y == array([[4, 5, 6, 7], + [4, 5, 6, 7], + [4, 5, 6, 7]]))) + + def test_sparse(self): + [X, Y] = meshgrid([1, 2, 3], [4, 5, 6, 7], sparse=True) + assert_(all(X == array([[1, 2, 3]]))) + assert_(all(Y == array([[4], + [5], + [6], + [7]]))) + + class TestPiecewise(TestCase): -- cgit v1.2.1