fix test_utils
MODIFY
tests/test_utils.py
tests/test_utils.py
import pytest
-from pangeo_forge import utils
+from pangeo_forge.utils import chunk_bounds_and_conflicts, chunked_iterable
@pytest.mark.parametrize(
@@ -13,13 +13,16 @@ from pangeo_forge import utils
],
)
def test_chunked_iterable(iterable, size, expected):
- actual = list(utils.chunked_iterable(iterable, size))
+ actual = list(chunked_iterable(iterable, size))
assert actual == expected
def test_chunk_conflicts():
zchunks = 10
- assert utils.calc_chunk_conflicts([10, 10], zchunks) == [(), ()]
- assert utils.calc_chunk_conflicts([9, 10], zchunks) == [(0,), (0,)]
- assert utils.calc_chunk_conflicts([10, 9, 11, 10], zchunks) == [(), (1,), (1,), ()]
- assert utils.calc_chunk_conflicts([9, 12, 5], zchunks) == [(0,), (0, 2), (2,)]
+ assert chunk_bounds_and_conflicts([10, 10], zchunks) == ([0, 10, 20], [(), ()])
+ assert chunk_bounds_and_conflicts([9, 10], zchunks) == ([0, 9, 19], [(0,), (0,)])
+ assert chunk_bounds_and_conflicts([10, 9, 11, 10], zchunks) == (
+ [0, 10, 19, 30, 40],
+ [(), (1,), (1,), ()],
+ )
+ assert chunk_bounds_and_conflicts([9, 12, 5], zchunks) == ([0, 9, 21, 26], [(0,), (0, 2), (2,)])

fix test_utils