Skip to content

Commit 690c620

Browse files
committed
TEST: Validate bad version parse warning when hit with min/max version
1 parent 44497f2 commit 690c620

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

nipype/interfaces/base/tests/test_core.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# vi: set ft=python sts=4 ts=4 sw=4 et:
44
import os
55
import simplejson as json
6+
import logging
67

78
import pytest
89
from unittest import mock
@@ -236,6 +237,21 @@ class DerivedInterface1(nib.BaseInterface):
236237
obj._check_version_requirements(obj.inputs)
237238

238239

240+
def test_input_version_missing(caplog):
241+
class DerivedInterface(nib.BaseInterface):
242+
class input_spec(nib.TraitedSpec):
243+
foo = nib.traits.Int(min_ver="0.9")
244+
bar = nib.traits.Int(max_ver="0.9")
245+
_version = "misparsed-garbage"
246+
247+
obj = DerivedInterface()
248+
obj.inputs.foo = 1
249+
obj.inputs.bar = 1
250+
with caplog.at_level(logging.WARNING, logger="nipype.interface"):
251+
obj._check_version_requirements(obj.inputs)
252+
assert len(caplog.records) == 2
253+
254+
239255
def test_output_version():
240256
class InputSpec(nib.TraitedSpec):
241257
foo = nib.traits.Int(desc="a random int")

0 commit comments

Comments
 (0)