Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel concatenate #5926

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
More tests
  • Loading branch information
bouweandela committed May 15, 2024
commit eb0b340a221bd1468c3de62ded5fe4afbea45fb6
19 changes: 16 additions & 3 deletions lib/iris/tests/unit/concatenate/test_hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,24 @@
[
(np.arange(2), da.arange(2), True),
(np.array([1], dtype=np.float32), np.array([1], dtype=bool), True),
(np.array([1]), np.array([[1]]), False),
(np.ma.array([1, 2], mask=[0, 1]), np.ma.array([1, 2], mask=[0, 1]), True),
(da.arange(2, chunks=1), da.arange(2, chunks=2), True),
(np.ma.array([1, 2], mask=[0, 1]), np.ma.array([1, 2], mask=[0, 0]), False),
(da.arange(6).reshape((2, 3)), da.arange(6, chunks=1).reshape((2, 3)), True),
(da.arange(20, chunks=1), da.arange(20, chunks=2), True),
(
da.ma.masked_array([1, 2], mask=[0, 1]),
da.ma.masked_array([1, 2], mask=[0, 1]),
True,
),
],
)
def test_compute_hashes(a, b, eq):
hashes = _concatenate._compute_hashes([a, b])
assert eq == (hashes[tokenize(a)].value == hashes[tokenize(b)].value)
assert eq == (hashes[tokenize(a)] == hashes[tokenize(b)])


def test_arrayhash_incompatible_chunks_raises():
hash1 = _concatenate._ArrayHash(1, chunks=(1, 1))
hash2 = _concatenate._ArrayHash(1, chunks=(2,))
with pytest.raises(ValueError):
hash1 == hash2