(self)
| 6361 | assert_identical(expected, actual) |
| 6362 | |
| 6363 | def test_reduce_only_one_axis(self) -> None: |
| 6364 | def mean_only_one_axis(x, axis): |
| 6365 | if not isinstance(axis, integer_types): |
| 6366 | raise TypeError("non-integer axis") |
| 6367 | return x.mean(axis) |
| 6368 | |
| 6369 | ds = Dataset({"a": (["x", "y"], [[0, 1, 2, 3, 4]])}) |
| 6370 | expected = Dataset({"a": ("x", [2])}) |
| 6371 | actual = ds.reduce(mean_only_one_axis, "y") |
| 6372 | assert_identical(expected, actual) |
| 6373 | |
| 6374 | with pytest.raises( |
| 6375 | TypeError, match=r"missing 1 required positional argument: 'axis'" |
| 6376 | ): |
| 6377 | ds.reduce(mean_only_one_axis) |
| 6378 | |
| 6379 | def test_reduce_no_axis(self) -> None: |
| 6380 | def total_sum(x): |
nothing calls this directly
no test coverage detected