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

Method test_2d

numpy/ma/tests/test_extras.py:474–492  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

472 assert_array_equal(c.mask, mr_[m, 0, 0, m])
473
474 def test_2d(self):
475 # Tests mr_ on 2D arrays.
476 a_1 = np.random.rand(5, 5)
477 a_2 = np.random.rand(5, 5)
478 m_1 = np.round(np.random.rand(5, 5), 0)
479 m_2 = np.round(np.random.rand(5, 5), 0)
480 b_1 = masked_array(a_1, mask=m_1)
481 b_2 = masked_array(a_2, mask=m_2)
482 # append columns
483 d = mr_['1', b_1, b_2]
484 assert_(d.shape == (5, 10))
485 assert_array_equal(d[:, :5], b_1)
486 assert_array_equal(d[:, 5:], b_2)
487 assert_array_equal(d.mask, np.r_['1', m_1, m_2])
488 d = mr_[b_1, b_2]
489 assert_(d.shape == (10, 5))
490 assert_array_equal(d[:5, :], b_1)
491 assert_array_equal(d[5:, :], b_2)
492 assert_array_equal(d.mask, np.r_[m_1, m_2])
493
494 def test_masked_constant(self):
495 actual = mr_[np.ma.masked, 1]

Callers

nothing calls this directly

Calls 3

assert_array_equalFunction · 0.90
assert_Function · 0.85
roundMethod · 0.80

Tested by

no test coverage detected