From 5cf7a2013d73f3fb4d73315b389df65a1e5d0667 Mon Sep 17 00:00:00 2001 From: Robin Wilson Date: Sun, 30 Aug 2015 22:49:24 +0100 Subject: [PATCH] Fixed tests to use assertRaises as a function not a context manager --- skimage/feature/tests/test_canny.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/skimage/feature/tests/test_canny.py b/skimage/feature/tests/test_canny.py index 21ffc52f..bb0d7825 100644 --- a/skimage/feature/tests/test_canny.py +++ b/skimage/feature/tests/test_canny.py @@ -94,19 +94,14 @@ class TestCanny(unittest.TestCase): def test_invalid_use_quantiles(self): image = img_as_float(data.camera()[::50,::50]) - with self.assertRaises(ValueError): - result = F.canny(image, use_quantiles=True, - low_threshold=0.5, high_threshold=3.6) + self.assertRaises(ValueError, F.canny, image, use_quantiles=True, + low_threshold=0.5, high_threshold=3.6) - with self.assertRaises(ValueError): - result = F.canny(image, use_quantiles=True, - low_threshold=99, high_threshold=0.9) + self.assertRaises(ValueError, F.canny, image, use_quantiles=True, + low_threshold=-5, high_threshold=0.5) - with self.assertRaises(ValueError): - result = F.canny(image, use_quantiles=True, - low_threshold=-5, high_threshold=0.5) - - with self.assertRaises(ValueError): - result = F.canny(image, use_quantiles=True, - low_threshold=0.5, high_threshold=-100) + self.assertRaises(ValueError, F.canny, image, use_quantiles=True, + low_threshold=99, high_threshold=0.9) + self.assertRaises(ValueError, F.canny, image, use_quantiles=True, + low_threshold=0.5, high_threshold=-100)