| 1507 | assert_equal(xx.real.dtype, xx._data.real.dtype) |
| 1508 | |
| 1509 | def test_methods_with_output(self): |
| 1510 | xm = array(np.random.uniform(0, 10, 12)).reshape(3, 4) |
| 1511 | xm[:, 0] = xm[0] = xm[-1, -1] = masked |
| 1512 | |
| 1513 | funclist = ('sum', 'prod', 'var', 'std', 'max', 'min', 'ptp', 'mean',) |
| 1514 | |
| 1515 | for funcname in funclist: |
| 1516 | npfunc = getattr(np, funcname) |
| 1517 | xmmeth = getattr(xm, funcname) |
| 1518 | # A ndarray as explicit input |
| 1519 | output = np.empty(4, dtype=float) |
| 1520 | output.fill(-9999) |
| 1521 | result = npfunc(xm, axis=0, out=output) |
| 1522 | # ... the result should be the given output |
| 1523 | assert_(result is output) |
| 1524 | assert_equal(result, xmmeth(axis=0, out=output)) |
| 1525 | |
| 1526 | output = empty(4, dtype=int) |
| 1527 | result = xmmeth(axis=0, out=output) |
| 1528 | assert_(result is output) |
| 1529 | assert_(output[0] is masked) |
| 1530 | |
| 1531 | def test_eq_on_structured(self): |
| 1532 | # Test the equality of structured arrays |