MCPcopy Create free account
hub / github.com/numpy/numpy / test_axis_insertion_ma

Method test_axis_insertion_ma

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

Source from the content-addressed store, hash-verified

216 self.test_axis_insertion(MinimalSubclass)
217
218 def test_axis_insertion_ma(self):
219 def f1to2(x):
220 """produces an asymmetric non-square matrix from x"""
221 assert_equal(x.ndim, 1)
222 res = x[::-1] * x[1:,None]
223 return np.ma.masked_where(res%5==0, res)
224 a = np.arange(6*3).reshape((6, 3))
225 res = apply_along_axis(f1to2, 0, a)
226 assert_(isinstance(res, np.ma.masked_array))
227 assert_equal(res.ndim, 3)
228 assert_array_equal(res[:,:,0].mask, f1to2(a[:,0]).mask)
229 assert_array_equal(res[:,:,1].mask, f1to2(a[:,1]).mask)
230 assert_array_equal(res[:,:,2].mask, f1to2(a[:,2]).mask)
231
232 def test_tuple_func1d(self):
233 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