Skip to content

Commit 5f37ffa

Browse files
committed
FIX: Version comparison on alert_future_error
1 parent 4180847 commit 5f37ffa

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

nibabel/deprecated.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def alert_future_error(
111111
Warnings stacklevel to provide; note that this will be incremented by
112112
1, so provide the stacklevel you would provide directly to warnings.warn()
113113
"""
114-
if cmp_pkg_version(version) >= 0:
114+
if cmp_pkg_version(version) > 0:
115115
msg = f'{msg} This will error in NiBabel {version}. {warning_rec}'
116116
warnings.warn(msg.strip(), warning_class, stacklevel=stacklevel + 1)
117117
else:

nibabel/tests/test_deprecated.py

+8
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,11 @@ def test_alert_future_error():
109109
error_rec='Fix this issue by doing XYZ.',
110110
error_class=ValueError,
111111
)
112+
with pytest.raises(ValueError):
113+
alert_future_error(
114+
'Message',
115+
'2.0.0', # Error if we equal the (patched) version
116+
warning_rec='Silence this warning by doing XYZ.',
117+
error_rec='Fix this issue by doing XYZ.',
118+
error_class=ValueError,
119+
)

0 commit comments

Comments
 (0)