MCPcopy Index your code
hub / github.com/numpy/numpy / test_indexing

Method test_indexing

numpy/lib/tests/test_function_base.py:2789–2807  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2787 assert_array_equal([], meshgrid(*args, copy=False))
2788
2789 def test_indexing(self):
2790 x = [1, 2, 3]
2791 y = [4, 5, 6, 7]
2792 [X, Y] = meshgrid(x, y, indexing='ij')
2793 assert_array_equal(X, np.array([[1, 1, 1, 1],
2794 [2, 2, 2, 2],
2795 [3, 3, 3, 3]]))
2796 assert_array_equal(Y, np.array([[4, 5, 6, 7],
2797 [4, 5, 6, 7],
2798 [4, 5, 6, 7]]))
2799
2800 # Test expected shapes:
2801 z = [8, 9]
2802 assert_(meshgrid(x, y)[0].shape == (4, 3))
2803 assert_(meshgrid(x, y, indexing='ij')[0].shape == (3, 4))
2804 assert_(meshgrid(x, y, z)[0].shape == (4, 3, 2))
2805 assert_(meshgrid(x, y, z, indexing='ij')[0].shape == (3, 4, 2))
2806
2807 assert_raises(ValueError, meshgrid, x, y, indexing='notvalid')
2808
2809 def test_sparse(self):
2810 [X, Y] = meshgrid([1, 2, 3], [4, 5, 6, 7], sparse=True)

Callers

nothing calls this directly

Calls 4

meshgridFunction · 0.90
assert_array_equalFunction · 0.90
assert_Function · 0.90
assert_raisesFunction · 0.90

Tested by

no test coverage detected