Basic functionailty tests for '_chunk_xrf_map_numpy
(chunk_target, data_shape)
| 232 | ]) |
| 233 | # fmt: on |
| 234 | def test_chunk_numpy_array(chunk_target, data_shape): |
| 235 | """Basic functionailty tests for '_chunk_xrf_map_numpy""" |
| 236 | |
| 237 | data = np.random.random(data_shape) |
| 238 | data_dask = _chunk_numpy_array(data, chunk_target) |
| 239 | |
| 240 | chunksize_expected = tuple( |
| 241 | [min(chunk_target[0], data_shape[0]), min(chunk_target[1], data_shape[1]), *data_shape[2:]] |
| 242 | ) |
| 243 | |
| 244 | assert data_dask.shape == data.shape, "The shape of the original and chunked array don't match" |
| 245 | assert ( |
| 246 | data_dask.chunksize == chunksize_expected |
| 247 | ), "The chunk size of the Dask array doesn't match the desired chunk size" |
| 248 | npt.assert_array_equal( |
| 249 | data_dask.compute(), data, err_msg="The chunked array is different from the original array" |
| 250 | ) |
| 251 | |
| 252 | |
| 253 | # fmt: off |
nothing calls this directly
no test coverage detected