mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-13 17:45:20 +08:00
Replace a doc test with some regular unit tests.
This commit is contained in:
@@ -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],
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user