(self, axis)
| 887 | ) |
| 888 | @pytest.mark.filterwarnings("ignore:All-NaN slice:RuntimeWarning") |
| 889 | def test_keepdims_out(self, axis): |
| 890 | d = np.ones((3, 5, 7, 11)) |
| 891 | # Randomly set some elements to NaN: |
| 892 | w = np.random.random((4, 200)) * np.array(d.shape)[:, None] |
| 893 | w = w.astype(np.intp) |
| 894 | d[tuple(w)] = np.nan |
| 895 | if axis is None: |
| 896 | shape_out = (1,) * d.ndim |
| 897 | else: |
| 898 | axis_norm = normalize_axis_tuple(axis, d.ndim) |
| 899 | shape_out = tuple( |
| 900 | 1 if i in axis_norm else d.shape[i] for i in range(d.ndim)) |
| 901 | out = np.empty(shape_out) |
| 902 | result = np.nanmedian(d, axis=axis, keepdims=True, out=out) |
| 903 | assert result is out |
| 904 | assert_equal(result.shape, shape_out) |
| 905 | |
| 906 | def test_out(self): |
| 907 | mat = np.random.rand(3, 3) |
nothing calls this directly
no test coverage detected