(func, sparse_output)
| 534 | ids=repr, |
| 535 | ) |
| 536 | def 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( |
nothing calls this directly
no test coverage detected
searching dependent graphs…