From 0d431ffdff6e9b66bd999950274179cb7201c1d8 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 22 Aug 2024 17:47:01 +0200 Subject: [PATCH] add tolerance in test statistics --- tests/test_statistics_of_labelled_pixels.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/test_statistics_of_labelled_pixels.py b/tests/test_statistics_of_labelled_pixels.py index b4d1e941..5485e9fc 100644 --- a/tests/test_statistics_of_labelled_pixels.py +++ b/tests/test_statistics_of_labelled_pixels.py @@ -38,11 +38,17 @@ def test_statistics_of_labelled_pixels(): assert result["label"] == [1.0, 2.0, 3.0, 4.0] assert result["max_intensity"] == [14.0, 13.0, 12.0, 11.0] assert result["min_intensity"] == [0.0, 0.0, 0.0, 0.0] - assert result["mean_intensity"] == [ - 4.666666507720947, - 3.777777910232544, - 2.8888888359069824, - 2.0, - ] + assert np.allclose( + np.asarray(result["mean_intensity"]), + np.asarray( + [ + 4.666666507720947, + 3.777777910232544, + 2.8888888359069824, + 2.0, + ] + ), + atol=0.00001, + ) assert result["sum_intensity"] == [42.0, 34.0, 26.0, 18.0] assert result["area"] == [9.0, 9.0, 9.0, 9.0]