From 1a22c497ddc17f37ba9f985505b146de512f1142 Mon Sep 17 00:00:00 2001 From: Thomas Nicholas Date: Tue, 9 May 2023 15:09:32 -0400 Subject: [PATCH] initial test of automatically using cubed --- cubed_xarray/tests/test_wrapping.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 cubed_xarray/tests/test_wrapping.py diff --git a/cubed_xarray/tests/test_wrapping.py b/cubed_xarray/tests/test_wrapping.py new file mode 100644 index 0000000..00cbed9 --- /dev/null +++ b/cubed_xarray/tests/test_wrapping.py @@ -0,0 +1,22 @@ +import xarray as xr +from xarray.core.parallelcompat import list_chunkmanagers +import cubed + +from cubed_xarray.cubedmanager import CubedManager + + +class TestDiscoverCubedManager: + def test_list_cubedmanager(self): + chunkmanagers = list_chunkmanagers() + assert 'cubed' in chunkmanagers + assert isinstance(chunkmanagers['cubed'], CubedManager) + + def test_chunk(self): + da = xr.DataArray([1, 2], dims='x') + chunked = da.chunk(x=1, chunked_array_type='cubed') + assert isinstance(chunked.data, cubed.Array) + assert chunked.chunksizes == {'x': (1, 1)} + + # TODO test cubed is default when dask not installed + + # TODO test dask is default over cubed when both installed