MCPcopy Index your code
hub / github.com/pydata/xarray / test_pad_stat_length

Method test_pad_stat_length

xarray/tests/test_dataarray.py:4711–4725  ·  view source on GitHub ↗
(self, mode, stat_length)

Source from the content-addressed store, hash-verified

4709 "stat_length", (None, 3, (1, 3), {"dim_0": (2, 1), "dim_2": (4, 2)})
4710 )
4711 def test_pad_stat_length(self, mode, stat_length) -> None:
4712 ar = DataArray(np.arange(3 * 4 * 5).reshape(3, 4, 5))
4713 actual = ar.pad(dim_0=(1, 3), dim_2=(2, 2), mode=mode, stat_length=stat_length)
4714 if isinstance(stat_length, dict):
4715 stat_length = (stat_length["dim_0"], (4, 4), stat_length["dim_2"])
4716 expected = DataArray(
4717 np.pad(
4718 np.arange(3 * 4 * 5).reshape(3, 4, 5),
4719 pad_width=((1, 3), (0, 0), (2, 2)),
4720 mode=mode,
4721 stat_length=stat_length,
4722 )
4723 )
4724 assert actual.shape == (7, 4, 9)
4725 assert_identical(actual, expected)
4726
4727 @pytest.mark.parametrize(
4728 "end_values", (None, 3, (3, 5), {"dim_0": (2, 1), "dim_2": (4, 2)})

Callers

nothing calls this directly

Calls 5

padMethod · 0.95
DataArrayClass · 0.90
assert_identicalFunction · 0.90
arangeMethod · 0.80
padMethod · 0.45

Tested by

no test coverage detected