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

Method test_round_with_scalar

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

Source from the content-addressed store, hash-verified

4398 assert_(result is output)
4399
4400 def test_round_with_scalar(self):
4401 # Testing round with scalar/zero dimension input
4402 # GH issue 2244
4403 a = array(1.1, mask=[False])
4404 assert_equal(a.round(), 1)
4405
4406 a = array(1.1, mask=[True])
4407 assert_(a.round() is masked)
4408
4409 a = array(1.1, mask=[False])
4410 output = np.empty(1, dtype=float)
4411 output.fill(-9999)
4412 a.round(out=output)
4413 assert_equal(output, 1)
4414
4415 a = array(1.1, mask=[False])
4416 output = array(-9999., mask=[True])
4417 a.round(out=output)
4418 assert_equal(output[()], 1)
4419
4420 a = array(1.1, mask=[True])
4421 output = array(-9999., mask=[False])
4422 a.round(out=output)
4423 assert_(output[()] is masked)
4424
4425 def test_identity(self):
4426 a = identity(5)

Callers

nothing calls this directly

Calls 4

arrayFunction · 0.90
assert_equalFunction · 0.90
roundMethod · 0.80
assert_Function · 0.50

Tested by

no test coverage detected