mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-12 12:50:49 +08:00
Handle more warnings and reset io plugins as needed
Reset plugins prior to running collections test Handle warnings in morphology pkg Add __init__ for morpohology tests Handle warnings for novice pkg Handle warnings for restoration pkg Handle warnings for segmentation pkg Handle warnings for _shared pkg Handle warnings for transform pkg Handle warnings for util pkg Handle warnings in viewer module
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
import warnings
|
||||
warnings.simplefilter('error')
|
||||
@@ -3,6 +3,7 @@ from numpy.testing import assert_equal, assert_raises
|
||||
from skimage import img_as_int, img_as_float, \
|
||||
img_as_uint, img_as_ubyte
|
||||
from skimage.util.dtype import convert
|
||||
from skimage._shared.utils import all_warnings
|
||||
|
||||
|
||||
dtype_range = {np.uint8: (0, 255),
|
||||
@@ -28,7 +29,9 @@ def test_range():
|
||||
(img_as_float, np.float64),
|
||||
(img_as_uint, np.uint16),
|
||||
(img_as_ubyte, np.ubyte)]:
|
||||
y = f(x)
|
||||
|
||||
with all_warnings(): # precision loss
|
||||
y = f(x)
|
||||
|
||||
omin, omax = dtype_range[dt]
|
||||
|
||||
@@ -59,7 +62,8 @@ def test_range_extra_dtypes():
|
||||
for dtype_in, dt in dtype_pairs:
|
||||
imin, imax = dtype_range_extra[dtype_in]
|
||||
x = np.linspace(imin, imax, 10).astype(dtype_in)
|
||||
y = convert(x, dt)
|
||||
with all_warnings(): # sign loss
|
||||
y = convert(x, dt)
|
||||
omin, omax = dtype_range_extra[dt]
|
||||
yield (_verify_range,
|
||||
"From %s to %s" % (np.dtype(dtype_in), np.dtype(dt)),
|
||||
|
||||
Reference in New Issue
Block a user