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

Function test_dataarray_method

xarray/tests/test_sparse.py:536–548  ·  view source on GitHub ↗
(func, sparse_output)

Source from the content-addressed store, hash-verified

534 ids=repr,
535)
536def test_dataarray_method(func, sparse_output):
537 arr_s = make_xrarray(
538 {"x": 10, "y": 5}, coords={"x": np.arange(10), "y": np.arange(5)}
539 )
540 arr_d = xr.DataArray(arr_s.data.todense(), coords=arr_s.coords, dims=arr_s.dims)
541 ret_s = func(arr_s)
542 ret_d = func(arr_d)
543
544 if sparse_output:
545 assert isinstance(ret_s.data, sparse.SparseArray)
546 assert np.allclose(ret_s.data.todense(), ret_d.data, equal_nan=True)
547 else:
548 assert np.allclose(ret_s, ret_d, equal_nan=True)
549
550
551@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

make_xrarrayFunction · 0.85
arangeMethod · 0.80
funcFunction · 0.70
todenseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…