Skip to content

Commit

Permalink
Skip QualityMetrics tests if scikit-image is not installed (#1711)
Browse files Browse the repository at this point in the history
  • Loading branch information
MargaretDuff authored Feb 15, 2024
1 parent ecb5db0 commit 00bf936
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Wrappers/Python/test/test_quality_measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

initialise_tests()

@unittest.skipIf((not has_skimage) , "Skip test with has_skimage {}".format( has_skimage))
class TestQualityMeasures(CCPiTestClass):

def setUp(self):
Expand Down Expand Up @@ -70,35 +71,29 @@ def setUp(self):
processor.set_input(id_coins_noisy )
self.id_coins_noisy_sliced= processor.get_output()

@unittest.skipIf((not has_skimage) , "Skip test with has_skimage {}".format( has_skimage))

def test_mse1(self):
res1 = mse(self.id_coins, self.id_coins_noisy)
res2 = mean_squared_error(self.id_coins.as_array(), self.id_coins_noisy.as_array())
np.testing.assert_almost_equal(res1, res2, decimal=5)


@unittest.skipIf((not has_skimage), "Skip test with has_skimage {}".format( has_skimage))
def test_mse2(self):
res1 = mse(self.dc1, self.dc2)
res2 = mean_squared_error(self.dc1.as_array(), self.dc2.as_array())
np.testing.assert_almost_equal(res1, res2, decimal=5)

@unittest.skipIf((not has_skimage), "Skip test with has_skimage {}".format( has_skimage))
def test_psnr1(self):
res1 = psnr(self.id_coins, self.id_coins_noisy, data_range = self.dc1.max())
res2 = peak_signal_noise_ratio(self.id_coins.as_array(), self.id_coins_noisy.as_array())
np.testing.assert_almost_equal(res1, res2, decimal=3)

@unittest.skipIf((not has_skimage), "Skip test with has_skimage {}".format( has_skimage))
def test_psnr2_default_data_range(self):
res1 = psnr(self.id_coins, self.id_coins_noisy)
res2 = peak_signal_noise_ratio(self.id_coins.as_array(), self.id_coins_noisy.as_array())
np.testing.assert_almost_equal(res1, res2, decimal=3)




@unittest.skipIf((not has_skimage), "Skip test with has_skimage {}".format( has_skimage))
def test_psnr2(self):
res1 = psnr(self.dc1, self.dc2, data_range = self.dc1.max())
res2 = peak_signal_noise_ratio(self.dc1.as_array(), self.dc2.as_array())
Expand Down

0 comments on commit 00bf936

Please sign in to comment.