1diff --git a/skimage/exposure/tests/test_exposure.py b/skimage/exposure/tests/test_exposure.py
2index ed8dd6bc8..8ec7d13bf 100644
3--- a/skimage/exposure/tests/test_exposure.py
4+++ b/skimage/exposure/tests/test_exposure.py
5@@ -368,19 +368,16 @@ def test_rescale_nan_warning(in_range, out_range):
6 )
7
8 # 2019/11/10 Passing NaN to np.clip raises a DeprecationWarning for
9- # versions above 1.17
10- # TODO: Remove once NumPy removes this DeprecationWarning
11+ # versions above 1.17, "|\A\Z" marks as optional warning
12+ # TODO: Remove once NumPy 1.25.0 is minimal dependency
13 numpy_warning_1_17_plus = (
14- "Passing `np.nan` to mean no clipping in np.clip"
15+ "|\\A\\ZPassing `np.nan` to mean no clipping in np.clip"
16 )
17
18- if in_range == "image":
19- exp_warn = [msg, numpy_warning_1_17_plus]
20- else:
21- exp_warn = [msg]
22+ with expected_warnings([msg, numpy_warning_1_17_plus]):
23+ result = exposure.rescale_intensity(image, in_range, out_range)
24
25- with expected_warnings(exp_warn):
26- exposure.rescale_intensity(image, in_range, out_range)
27+ assert np.all(np.isnan(result))
28
29
30 @pytest.mark.parametrize(