| 1667 | assert_equal(xx.real.dtype, xx._data.real.dtype) |
| 1668 | |
| 1669 | def test_methods_with_output(self): |
| 1670 | xm = array(np.random.uniform(0, 10, 12)).reshape(3, 4) |
| 1671 | xm[:, 0] = xm[0] = xm[-1, -1] = masked |
| 1672 | |
| 1673 | funclist = ('sum', 'prod', 'var', 'std', 'max', 'min', 'ptp', 'mean',) |
| 1674 | |
| 1675 | for funcname in funclist: |
| 1676 | npfunc = getattr(np, funcname) |
| 1677 | xmmeth = getattr(xm, funcname) |
| 1678 | # A ndarray as explicit input |
| 1679 | output = np.empty(4, dtype=float) |
| 1680 | output.fill(-9999) |
| 1681 | result = npfunc(xm, axis=0, out=output) |
| 1682 | # ... the result should be the given output |
| 1683 | assert_(result is output) |
| 1684 | assert_equal(result, xmmeth(axis=0, out=output)) |
| 1685 | |
| 1686 | output = empty(4, dtype=int) |
| 1687 | result = xmmeth(axis=0, out=output) |
| 1688 | assert_(result is output) |
| 1689 | assert_(output[0] is masked) |
| 1690 | |
| 1691 | def test_eq_on_structured(self): |
| 1692 | # Test the equality of structured arrays |