diff --git a/skimage/filter/__init__.py b/skimage/filter/__init__.py index 5d43f69d..8b81c254 100644 --- a/skimage/filter/__init__.py +++ b/skimage/filter/__init__.py @@ -36,7 +36,7 @@ denoise_tv_chambolle = deprecated('skimage.restoration.denoise_tv_chambolle')\ (restoration.denoise_tv_chambolle) # Backward compatibility v<0.11 -@deprecated +@deprecated('skimage.feature.canny') def canny(*args, **kwargs): # Hack to avoid circular import from skimage.feature._canny import canny as canny_ diff --git a/skimage/filters/__init__.py b/skimage/filters/__init__.py index aeba00f7..795819c6 100644 --- a/skimage/filters/__init__.py +++ b/skimage/filters/__init__.py @@ -23,7 +23,7 @@ denoise_tv_chambolle = deprecated('skimage.restoration.denoise_tv_chambolle')\ (restoration.denoise_tv_chambolle) # Backward compatibility v<0.11 -@deprecated +@deprecated('skimage.feature.canny') def canny(*args, **kwargs): # Hack to avoid circular import from ..feature._canny import canny as canny_ diff --git a/skimage/filters/tests/test_deprecated_imports.py b/skimage/filters/tests/test_deprecated_imports.py new file mode 100644 index 00000000..2ea21ca2 --- /dev/null +++ b/skimage/filters/tests/test_deprecated_imports.py @@ -0,0 +1,19 @@ +from warnings import catch_warnings, simplefilter +from ..._shared._warnings import expected_warnings +from ...data import moon + + +def test_filter_import(): + with catch_warnings(): + simplefilter('ignore') + from skimage import filter as F + + assert('sobel' in dir(F)) + assert F._import_warned + + +def test_canny_import(): + data = moon() + with expected_warnings(['skimage.feature.canny']): + from skimage.filters import canny + canny(data) diff --git a/skimage/filters/tests/test_filter_import.py b/skimage/filters/tests/test_filter_import.py deleted file mode 100644 index 90384324..00000000 --- a/skimage/filters/tests/test_filter_import.py +++ /dev/null @@ -1,10 +0,0 @@ -from warnings import catch_warnings, simplefilter - - -def test_filter_import(): - with catch_warnings(): - simplefilter('ignore') - from skimage import filter as F - - assert('sobel' in dir(F)) - assert F._import_warned