Replace a doc test with some regular unit tests.

This commit is contained in:
John Wiggins
2015-08-28 21:03:01 +02:00
parent ff4e3bd0bd
commit c05108da36
2 changed files with 15 additions and 4 deletions
-4
View File
@@ -74,10 +74,6 @@ def gaussian_filter(image, sigma, output=None, mode='nearest', cval=0,
array([[ 0.05855018, 0.09653293, 0.05855018],
[ 0.09653293, 0.15915589, 0.09653293],
[ 0.05855018, 0.09653293, 0.05855018]])
>>> gaussian_filter(a, sigma=-1)
Traceback (most recent call last):
...
ValueError: Sigma values less than zero are not valid
>>> # Several modes are possible for handling boundaries
>>> gaussian_filter(a, sigma=1, mode='reflect')
array([[ 0.08767308, 0.12075024, 0.08767308],
+15
View File
@@ -1,8 +1,23 @@
from nose.tools import raises
import numpy as np
from skimage.filters._gaussian import gaussian_filter
from skimage._shared._warnings import expected_warnings
@raises(ValueError)
def test_negative_sigma():
a = np.zeros((3, 3))
a[1, 1] = 1.
gaussian_filter(a, -1.0)
@raises(ValueError)
def test_multiple_negative_sigma():
a = np.zeros((3, 3))
a[1, 1] = 1.
gaussian_filter(a, [-1.0, 1.0])
def test_null_sigma():
a = np.zeros((3, 3))
a[1, 1] = 1.