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

Method test_round_with_output

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

Source from the content-addressed store, hash-verified

4380 assert_(z[2] is masked)
4381
4382 def test_round_with_output(self):
4383 # Testing round with an explicit output
4384
4385 xm = array(np.random.uniform(0, 10, 12)).reshape(3, 4)
4386 xm[:, 0] = xm[0] = xm[-1, -1] = masked
4387
4388 # A ndarray as explicit input
4389 output = np.empty((3, 4), dtype=float)
4390 output.fill(-9999)
4391 result = np.round(xm, decimals=2, out=output)
4392 # ... the result should be the given output
4393 assert_(result is output)
4394 assert_equal(result, xm.round(decimals=2, out=output))
4395
4396 output = empty((3, 4), dtype=float)
4397 result = xm.round(decimals=2, out=output)
4398 assert_(result is output)
4399
4400 def test_round_with_scalar(self):
4401 # Testing round with scalar/zero dimension input

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected