MCPcopy
hub / github.com/pydata/xarray / test_reduce_no_axis

Method test_reduce_no_axis

xarray/tests/test_dataset.py:6379–6389  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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(

Callers

nothing calls this directly

Calls 3

reduceMethod · 0.95
DatasetClass · 0.90
assert_identicalFunction · 0.90

Tested by

no test coverage detected