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

Method test_axis_insertion_ma

numpy/lib/tests/test_shape_base.py:247–259  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

245 self.test_axis_insertion(MinimalSubclass)
246
247 def test_axis_insertion_ma(self):
248 def f1to2(x):
249 """produces an asymmetric non-square matrix from x"""
250 assert_equal(x.ndim, 1)
251 res = x[::-1] * x[1:, None]
252 return np.ma.masked_where(res % 5 == 0, res)
253 a = np.arange(6 * 3).reshape((6, 3))
254 res = apply_along_axis(f1to2, 0, a)
255 assert_(isinstance(res, np.ma.masked_array))
256 assert_equal(res.ndim, 3)
257 assert_array_equal(res[:, :, 0].mask, f1to2(a[:, 0]).mask)
258 assert_array_equal(res[:, :, 1].mask, f1to2(a[:, 1]).mask)
259 assert_array_equal(res[:, :, 2].mask, f1to2(a[:, 2]).mask)
260
261 def test_tuple_func1d(self):
262 def sample_1d(x):

Callers

nothing calls this directly

Calls 5

apply_along_axisFunction · 0.90
assert_Function · 0.90
assert_equalFunction · 0.90
assert_array_equalFunction · 0.90
reshapeMethod · 0.80

Tested by

no test coverage detected