Skip to content

Commit

Permalink
Fix bug in test__norm_input_labels_index (#43)
Browse files Browse the repository at this point in the history
* Fix test__norm_input_labels_index

The `ind_n` array is expected to be a 0-D array, but this check assumed
it was a 1-D singleton array, which is incorrect. Later versions of Dask
fixed `assert_eq` to better ensure that 0-D scalar arrays were not
compared equal to 1-D singleton arrays. So this fixes the test to behave
correctly.

* Test shapes in test__norm_input_labels_index

Make sure to explicitly test shapes of the normalized arrays in
`test__norm_input_labels_index`. Older versions of Dask would treat 1-D
scalar arrays as equivalent to 0-D arrays. So this check is important to
ensure that we are actually verifying `shape` and `ndim` are as
expected.

* Note test fix in history
  • Loading branch information
jakirkham committed Aug 31, 2018
1 parent cebf4d7 commit 86e9610
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
History
=======

0.1.1 (2018-08-31)
------------------

* Fix a bug in an ndmeasure test of an internal function.

0.1.0 (2018-08-31)
------------------

Expand Down
6 changes: 5 additions & 1 deletion tests/test_dask_image/test_ndmeasure/test__utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ def test__norm_input_labels_index():
assert isinstance(d_lbls_n, da.Array)
assert isinstance(ind_n, da.Array)

assert d_n.shape == d.shape
assert d_lbls_n.shape == d_lbls.shape
assert ind_n.shape == ()

dau.assert_eq(d_n, d)
dau.assert_eq(d_lbls_n, d_lbls)
dau.assert_eq(ind_n, np.array([1], dtype=int))
dau.assert_eq(ind_n, np.array(1, dtype=int))


@pytest.mark.parametrize(
Expand Down

0 comments on commit 86e9610

Please sign in to comment.