()
| 1428 | |
| 1429 | |
| 1430 | def test_map_blocks_roundtrip_string_index(): |
| 1431 | ds = xr.Dataset( |
| 1432 | {"data": (["label"], [1, 2, 3])}, coords={"label": ["foo", "bar", "baz"]} |
| 1433 | ).chunk(label=1) |
| 1434 | assert ds.label.dtype == np.dtype("=U3") |
| 1435 | |
| 1436 | mapped = ds.map_blocks(lambda x: x, template=ds) |
| 1437 | assert mapped.label.dtype == ds.label.dtype |
| 1438 | |
| 1439 | mapped = ds.map_blocks(lambda x: x, template=None) |
| 1440 | assert mapped.label.dtype == ds.label.dtype |
| 1441 | |
| 1442 | mapped = ds.data.map_blocks(lambda x: x, template=ds.data) |
| 1443 | assert mapped.label.dtype == ds.label.dtype |
| 1444 | |
| 1445 | mapped = ds.data.map_blocks(lambda x: x, template=None) |
| 1446 | assert mapped.label.dtype == ds.label.dtype |
| 1447 | |
| 1448 | |
| 1449 | def test_map_blocks_template_convert_object(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…