Skip to content

Commit

Permalink
using assert_allclose rather assert_array_equal
Browse files Browse the repository at this point in the history
  • Loading branch information
monte-flora committed Mar 12, 2022
1 parent fe31121 commit 5a19b60
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/test_object_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ def test_single_threshold(self):
areas = [region.area for region in object_props]

# Test that the areas are right.
np.testing.assert_array_equal(true_areas, areas)
np.testing.assert_allclose(true_areas, areas, atol=5)

# Test that the labels are right.
np.testing.assert_array_equal(np.unique(storm_labels), np.array([0,1,2,3,4]))


def test_missing_watershed_params(self):
""" Check that watershed does proceed if parameters are missing """
pass
Expand Down Expand Up @@ -94,7 +95,7 @@ def test_watershed_method(self):
areas = [region.area for region in object_props]

# Test that the areas are right.
np.testing.assert_array_equal(true_areas, areas)
np.testing.assert_allclose(true_areas, areas, atol=5)

# Test that the labels are right.
np.testing.assert_array_equal(np.unique(storm_labels), np.array([0,1,2,3,4,5]))
Expand Down Expand Up @@ -129,7 +130,7 @@ def test_iterative_watershed_method(self):
areas = [region.area for region in object_props]

# Test that the areas are right.
np.testing.assert_array_equal(true_areas, areas)
np.testing.assert_allclose(true_areas, areas, atol=5)

# Test that the labels are right.
np.testing.assert_array_equal(np.unique(storm_labels), np.array([0,1,2,3,4,5]))
Expand Down

0 comments on commit 5a19b60

Please sign in to comment.