mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-04 13:14:23 +08:00
Simplify warning test
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
from skimage._shared.utils import skimage_deprecation
|
||||
from warnings import warn_explicit
|
||||
__warningregistry__ = {}
|
||||
warn_explicit(skimage_deprecation('The `skimage.filter` module has been renamed to '
|
||||
'`skimage.filters`. This placeholder module '
|
||||
'will be removed in v0.13.'), category=None,
|
||||
filename=__file__, lineno=4,
|
||||
registry=__warningregistry__)
|
||||
del warn_explicit
|
||||
from warnings import warn
|
||||
|
||||
global _import_warned
|
||||
|
||||
warn(skimage_deprecation('The `skimage.filter` module has been renamed '
|
||||
'to `skimage.filters`. This placeholder module '
|
||||
'will be removed in v0.13.'))
|
||||
_import_warned = True
|
||||
|
||||
del warn
|
||||
del skimage_deprecation
|
||||
|
||||
from ..filters import *
|
||||
|
||||
@@ -3,9 +3,8 @@ from warnings import catch_warnings, simplefilter
|
||||
|
||||
def test_filter_import():
|
||||
with catch_warnings():
|
||||
simplefilter('always')
|
||||
simplefilter('ignore')
|
||||
from skimage import filter as F
|
||||
|
||||
assert('sobel' in dir(F))
|
||||
assert any(['has been renamed' in w
|
||||
for (w, _, _) in F.__warningregistry__])
|
||||
assert F._import_warned
|
||||
|
||||
Reference in New Issue
Block a user