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

Method test_pad_reflect

xarray/tests/test_dataarray.py:4752–4768  ·  view source on GitHub ↗
(self, mode, reflect_type)

Source from the content-addressed store, hash-verified

4750 @pytest.mark.parametrize("mode", ("reflect", "symmetric"))
4751 @pytest.mark.parametrize("reflect_type", (None, "even", "odd"))
4752 def test_pad_reflect(self, mode, reflect_type) -> None:
4753 ar = DataArray(np.arange(3 * 4 * 5).reshape(3, 4, 5))
4754 actual = ar.pad(
4755 dim_0=(1, 3), dim_2=(2, 2), mode=mode, reflect_type=reflect_type
4756 )
4757 np_kwargs = {
4758 "array": np.arange(3 * 4 * 5).reshape(3, 4, 5),
4759 "pad_width": ((1, 3), (0, 0), (2, 2)),
4760 "mode": mode,
4761 }
4762 # numpy does not support reflect_type=None
4763 if reflect_type is not None:
4764 np_kwargs["reflect_type"] = reflect_type
4765 expected = DataArray(np.pad(**np_kwargs))
4766
4767 assert actual.shape == (7, 4, 9)
4768 assert_identical(actual, expected)
4769
4770 @pytest.mark.parametrize(
4771 ["keep_attrs", "attrs", "expected"],

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