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

Method test_pad

xarray/tests/test_units.py:4716–4727  ·  view source on GitHub ↗
(self, dtype)

Source from the content-addressed store, hash-verified

4714 assert expected == actual
4715
4716 def test_pad(self, dtype):
4717 a = np.linspace(0, 5, 10).astype(dtype) * unit_registry.Pa
4718 b = np.linspace(-5, 0, 10).astype(dtype) * unit_registry.degK
4719
4720 ds = xr.Dataset({"a": ("x", a), "b": ("x", b)})
4721 units = extract_units(ds)
4722
4723 expected = attach_units(strip_units(ds).pad(x=(2, 3)), units)
4724 actual = ds.pad(x=(2, 3))
4725
4726 assert_units_equal(expected, actual)
4727 assert_equal(expected, actual)
4728
4729 @pytest.mark.parametrize(
4730 "func",

Callers

nothing calls this directly

Calls 8

padMethod · 0.95
assert_equalFunction · 0.90
extract_unitsFunction · 0.85
attach_unitsFunction · 0.85
strip_unitsFunction · 0.85
assert_units_equalFunction · 0.85
linspaceMethod · 0.80
astypeMethod · 0.45

Tested by

no test coverage detected