diff options
author | Ralf Gommers <ralf.gommers@googlemail.com> | 2011-12-28 10:30:08 +0100 |
---|---|---|
committer | Ralf Gommers <ralf.gommers@googlemail.com> | 2011-12-28 10:30:08 +0100 |
commit | 3fb541ef51ca60cf5a903ed83f69120fe3f5373a (patch) | |
tree | 43edfe4f0c61db86a0471844f0d55ab119789842 /numpy/lib/tests/test_function_base.py | |
parent | 4e571172a210612bdeba1db0135b7d5fbc44ee0c (diff) | |
download | numpy-3fb541ef51ca60cf5a903ed83f69120fe3f5373a.tar.gz |
TST: meshgrid: test expected shapes for Cartesian and matrix indexing.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 13 |
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]]))) |