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

Method test_diag

numpy/ma/tests/test_core.py:4125–4137  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4123 assert_equal(test.mask, [1, 1, 1])
4124
4125 def test_diag(self):
4126 # Test diag
4127 x = arange(9).reshape((3, 3))
4128 x[1, 1] = masked
4129 out = np.diag(x)
4130 assert_equal(out, [0, 4, 8])
4131 out = diag(x)
4132 assert_equal(out, [0, 4, 8])
4133 assert_equal(out.mask, [0, 1, 0])
4134 out = diag(out)
4135 control = array([[0, 0, 0], [0, 4, 0], [0, 0, 8]],
4136 mask=[[0, 0, 0], [0, 1, 0], [0, 0, 0]])
4137 assert_equal(out, control)
4138
4139 def test_axis_methods_nomask(self):
4140 # Test the combination nomask & methods w/ axis

Callers

nothing calls this directly

Calls 5

assert_equalFunction · 0.90
diagFunction · 0.90
arrayFunction · 0.90
arangeFunction · 0.85
reshapeMethod · 0.80

Tested by

no test coverage detected