(self)
| 4358 | [1, 0, 1, 0, 1]) |
| 4359 | |
| 4360 | def test_round(self): |
| 4361 | a = array([1.23456, 2.34567, 3.45678, 4.56789, 5.67890], |
| 4362 | mask=[0, 1, 0, 0, 0]) |
| 4363 | assert_equal(a.round(), [1., 2., 3., 5., 6.]) |
| 4364 | assert_equal(a.round(1), [1.2, 2.3, 3.5, 4.6, 5.7]) |
| 4365 | assert_equal(a.round(3), [1.235, 2.346, 3.457, 4.568, 5.679]) |
| 4366 | b = empty_like(a) |
| 4367 | a.round(out=b) |
| 4368 | assert_equal(b, [1., 2., 3., 5., 6.]) |
| 4369 | |
| 4370 | x = array([1., 2., 3., 4., 5.]) |
| 4371 | c = array([1, 1, 1, 0, 0]) |
| 4372 | x[2] = masked |
| 4373 | z = where(c, x, -x) |
| 4374 | assert_equal(z, [1., 2., 0., -4., -5]) |
| 4375 | c[0] = masked |
| 4376 | z = where(c, x, -x) |
| 4377 | assert_equal(z, [1., 2., 0., -4., -5]) |
| 4378 | assert_(z[0] is masked) |
| 4379 | assert_(z[1] is not masked) |
| 4380 | assert_(z[2] is masked) |
| 4381 | |
| 4382 | def test_round_with_output(self): |
| 4383 | # Testing round with an explicit output |
nothing calls this directly
no test coverage detected