MCPcopy
hub / github.com/numpy/numpy / test_round_with_output

Method test_round_with_output

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

Source from the content-addressed store, hash-verified

4607 assert_(z[2] is masked)
4608
4609 def test_round_with_output(self):
4610 # Testing round with an explicit output
4611
4612 xm = array(np.random.uniform(0, 10, 12)).reshape(3, 4)
4613 xm[:, 0] = xm[0] = xm[-1, -1] = masked
4614
4615 # A ndarray as explicit input
4616 output = np.empty((3, 4), dtype=float)
4617 output.fill(-9999)
4618 result = np.round(xm, decimals=2, out=output)
4619 # ... the result should be the given output
4620 assert_(result is output)
4621 assert_equal(result, xm.round(decimals=2, out=output))
4622
4623 output = empty((3, 4), dtype=float)
4624 result = xm.round(decimals=2, out=output)
4625 assert_(result is output)
4626
4627 def test_round_with_scalar(self):
4628 # Testing round with scalar/zero dimension input

Callers

nothing calls this directly

Calls 7

arrayFunction · 0.90
assert_equalFunction · 0.90
assert_Function · 0.85
emptyFunction · 0.85
reshapeMethod · 0.80
uniformMethod · 0.80
roundMethod · 0.80

Tested by

no test coverage detected