(self)
| 4585 | [1, 0, 1, 0, 1]) |
| 4586 | |
| 4587 | def test_round(self): |
| 4588 | a = array([1.23456, 2.34567, 3.45678, 4.56789, 5.67890], |
| 4589 | mask=[0, 1, 0, 0, 0]) |
| 4590 | assert_equal(a.round(), [1., 2., 3., 5., 6.]) |
| 4591 | assert_equal(a.round(1), [1.2, 2.3, 3.5, 4.6, 5.7]) |
| 4592 | assert_equal(a.round(3), [1.235, 2.346, 3.457, 4.568, 5.679]) |
| 4593 | b = empty_like(a) |
| 4594 | a.round(out=b) |
| 4595 | assert_equal(b, [1., 2., 3., 5., 6.]) |
| 4596 | |
| 4597 | x = array([1., 2., 3., 4., 5.]) |
| 4598 | c = array([1, 1, 1, 0, 0]) |
| 4599 | x[2] = masked |
| 4600 | z = where(c, x, -x) |
| 4601 | assert_equal(z, [1., 2., 0., -4., -5]) |
| 4602 | c[0] = masked |
| 4603 | z = where(c, x, -x) |
| 4604 | assert_equal(z, [1., 2., 0., -4., -5]) |
| 4605 | assert_(z[0] is masked) |
| 4606 | assert_(z[1] is not masked) |
| 4607 | assert_(z[2] is masked) |
| 4608 | |
| 4609 | def test_round_with_output(self): |
| 4610 | # Testing round with an explicit output |
nothing calls this directly
no test coverage detected