old_contents: from skimage._shared.utils import all_warnings, skimage_deprecation
  from numpy.testing import assert_warns
  
  def import_filter():
      from skimage import filter as F
      assert('sobel' in dir(F))
  
  def test_filter_import():
      with all_warnings():
          assert_warns(skimage_deprecation, import_filter)
  
new_contents: from numpy.testing import assert_warns
  from warnings import catch_warnings, simplefilter
  
  def test_import_filter():
      with catch_warnings():
          simplefilter('ignore')
          from skimage import filter as F
  
      assert('sobel' in dir(F))
  
subject: Check for deprecation on import is problematic. Rather just check that filter can be imported normally.