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

Method test_propagate_attrs

xarray/tests/test_dataarray.py:3286–3296  ·  view source on GitHub ↗
(self, func)

Source from the content-addressed store, hash-verified

3284 "func", [lambda x: x.clip(0, 1), lambda x: np.float64(1.0) * x, np.abs, abs]
3285 )
3286 def test_propagate_attrs(self, func) -> None:
3287 da = DataArray(self.va)
3288
3289 # test defaults
3290 assert func(da).attrs == da.attrs
3291
3292 with set_options(keep_attrs=False):
3293 assert func(da).attrs == {}
3294
3295 with set_options(keep_attrs=True):
3296 assert func(da).attrs == da.attrs
3297
3298 def test_fillna(self) -> None:
3299 a = DataArray([np.nan, 1, np.nan, 3], coords={"x": range(4)}, dims="x")

Callers

nothing calls this directly

Calls 3

DataArrayClass · 0.90
set_optionsClass · 0.90
funcFunction · 0.70

Tested by

no test coverage detected