Fixed tests to use assertRaises as a function not a context manager

This commit is contained in:
Robin Wilson
2015-08-30 22:49:24 +01:00
parent 98bf488241
commit 5cf7a2013d
+8 -13
View File
@@ -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)