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

Function test_map_blocks_add_attrs

xarray/tests/test_dask.py:1320–1336  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

1318
1319@pytest.mark.parametrize("obj", [make_da(), make_ds()])
1320def test_map_blocks_add_attrs(obj):
1321 def add_attrs(obj):
1322 obj = obj.copy(deep=True)
1323 obj.attrs["new"] = "new"
1324 obj.cxy.attrs["new2"] = "new2"
1325 return obj
1326
1327 expected = add_attrs(obj)
1328 with raise_if_dask_computes():
1329 actual = xr.map_blocks(add_attrs, obj)
1330
1331 assert_identical(actual, expected)
1332
1333 # when template is specified, attrs are copied from template, not set by function
1334 with raise_if_dask_computes():
1335 actual = xr.map_blocks(add_attrs, obj, template=obj)
1336 assert_identical(actual, obj)
1337
1338
1339def test_map_blocks_change_name(map_da):

Callers

nothing calls this directly

Calls 4

raise_if_dask_computesFunction · 0.90
assert_identicalFunction · 0.90
add_attrsFunction · 0.85
map_blocksMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…