ENH: Change assert statement for better error output

This commit is contained in:
Tony S Yu
2012-08-26 16:36:28 -04:00
parent 8084faf1f6
commit 7d8bc48378
@@ -15,19 +15,19 @@ from skimage.morphology.greyreconstruct import reconstruction
def test_zeros():
"""Test reconstruction with image and mask of zeros"""
assert np.all(reconstruction(np.zeros((5, 7)), np.zeros((5, 7))) == 0)
assert_close(reconstruction(np.zeros((5, 7)), np.zeros((5, 7))), 0)
def test_image_equals_mask():
"""Test reconstruction where the image and mask are the same"""
assert np.all(reconstruction(np.ones((7, 5)), np.ones((7, 5))) == 1)
assert_close(reconstruction(np.ones((7, 5)), np.ones((7, 5))), 1)
def test_image_less_than_mask():
"""Test reconstruction where the image is uniform and less than mask"""
image = np.ones((5, 5))
mask = np.ones((5, 5)) * 2
assert np.all(reconstruction(image, mask) == 1)
assert_close(reconstruction(image, mask), 1)
def test_one_image_peak():
@@ -35,7 +35,7 @@ def test_one_image_peak():
image = np.ones((5, 5))
image[2, 2] = 2
mask = np.ones((5, 5)) * 3
assert np.all(reconstruction(image, mask) == 2)
assert_close(reconstruction(image, mask), 2)
def test_two_image_peaks():
@@ -60,13 +60,13 @@ def test_two_image_peaks():
[1, 1, 1, 1, 1, 3, 3, 3],
[1, 1, 1, 1, 1, 3, 3, 3],
[1, 1, 1, 1, 1, 3, 3, 3]])
assert np.all(reconstruction(image, mask) == expected)
assert_close(reconstruction(image, mask), expected)
def test_zero_image_one_mask():
"""Test reconstruction with an image of all zeros and a mask that's not"""
result = reconstruction(np.zeros((10, 10)), np.ones((10, 10)))
assert np.all(result == 0)
assert_close(result, 0)
def test_fill_hole():