We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 200e944 commit b5b623dCopy full SHA for b5b623d
nipype/interfaces/tests/test_base.py
@@ -91,6 +91,18 @@ class spec(nib.TraitedSpec):
91
#yield assert_equal, infields.hashval[1], hashval[1]
92
yield assert_equal, infields.__repr__(), '\nfoo = 1\ngoo = 0.0\n'
93
94
+def test_TraitedSpec_dynamic():
95
+ from cPickle import dumps, loads
96
+ a = nib.BaseTraitedSpec()
97
+ a.add_trait('foo', nib.traits.Int)
98
+ a.foo = 1
99
+ assign_a = lambda : setattr(a, 'foo', 'a')
100
+ yield assert_raises, Exception, assign_a
101
+ pkld_a = dumps(a)
102
+ unpkld_a = loads(pkld_a)
103
+ assign_a_again = lambda : setattr(unpkld_a, 'foo', 'a')
104
+ yield assert_raises, Exception, assign_a_again
105
+
106
def test_TraitedSpec_logic():
107
class spec3(nib.TraitedSpec):
108
_xor_inputs = ('foo', 'bar')
0 commit comments