(self)
| 6377 | ds.reduce(mean_only_one_axis) |
| 6378 | |
| 6379 | def test_reduce_no_axis(self) -> None: |
| 6380 | def total_sum(x): |
| 6381 | return np.sum(x.flatten()) |
| 6382 | |
| 6383 | ds = Dataset({"a": (["x", "y"], [[0, 1, 2, 3, 4]])}) |
| 6384 | expected = Dataset({"a": ((), 10)}) |
| 6385 | actual = ds.reduce(total_sum) |
| 6386 | assert_identical(expected, actual) |
| 6387 | |
| 6388 | with pytest.raises(TypeError, match=r"unexpected keyword argument 'axis'"): |
| 6389 | ds.reduce(total_sum, dim="x") |
| 6390 | |
| 6391 | def test_reduce_keepdims(self) -> None: |
| 6392 | ds = Dataset( |
nothing calls this directly
no test coverage detected