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

Method test_numpy_methods

xarray/tests/test_units.py:4174–4187  ·  view source on GitHub ↗
(self, func, dtype)

Source from the content-addressed store, hash-verified

4172 ids=repr,
4173 )
4174 def test_numpy_methods(self, func, dtype):
4175 a = np.linspace(1, -1, 10) * unit_registry.Pa
4176 b = np.linspace(-1, 1, 15) * unit_registry.degK
4177 ds = xr.Dataset({"a": ("x", a), "b": ("y", b)})
4178
4179 units_a = array_extract_units(func(a))
4180 units_b = array_extract_units(func(b))
4181 units = {"a": units_a, "b": units_b}
4182
4183 actual = func(ds)
4184 expected = attach_units(func(strip_units(ds)), units)
4185
4186 assert_units_equal(expected, actual)
4187 assert_equal(expected, actual)
4188
4189 @pytest.mark.parametrize("func", (method("clip", min=3, max=8),), ids=repr)
4190 @pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 7

assert_equalFunction · 0.90
array_extract_unitsFunction · 0.85
attach_unitsFunction · 0.85
strip_unitsFunction · 0.85
assert_units_equalFunction · 0.85
linspaceMethod · 0.80
funcFunction · 0.70

Tested by

no test coverage detected