File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -779,12 +779,14 @@ def _inputs_help(cls):
779
779
return helpstr
780
780
781
781
manhelpstr = ['' , '\t [Mandatory]' ]
782
- for name , spec in sorted (inputs .traits (mandatory = True ).items ()):
782
+ mandatory_items = inputs .traits (mandatory = True )
783
+ for name , spec in sorted (mandatory_items .items ()):
783
784
manhelpstr += cls ._get_trait_desc (inputs , name , spec )
784
785
785
786
opthelpstr = ['' , '\t [Optional]' ]
786
- for name , spec in sorted (inputs .traits (mandatory = None ,
787
- transient = None ).items ()):
787
+ for name , spec in sorted (inputs .traits (transient = None ).items ()):
788
+ if spec in mandatory_items :
789
+ continue
788
790
opthelpstr += cls ._get_trait_desc (inputs , name , spec )
789
791
790
792
if manhelpstr :
Original file line number Diff line number Diff line change @@ -245,10 +245,10 @@ def test_BaseInterface():
245
245
yield assert_equal , nib .BaseInterface .help (), None
246
246
yield assert_equal , nib .BaseInterface ._get_filecopy_info (), []
247
247
248
-
249
248
class InputSpec (nib .TraitedSpec ):
250
249
foo = nib .traits .Int (desc = 'a random int' )
251
250
goo = nib .traits .Int (desc = 'a random int' , mandatory = True )
251
+ moo = nib .traits .Int (desc = 'a random int' , mandatory = False )
252
252
hoo = nib .traits .Int (desc = 'a random int' , usedefault = True )
253
253
zoo = nib .File (desc = 'a file' , copyfile = False )
254
254
woo = nib .File (desc = 'a file' , copyfile = True )
@@ -258,6 +258,7 @@ class DerivedInterface(nib.BaseInterface):
258
258
input_spec = InputSpec
259
259
260
260
yield assert_equal , DerivedInterface .help (), None
261
+ yield assert_true , 'moo' in '' .join (DerivedInterface ._inputs_help ())
261
262
yield assert_equal , DerivedInterface ()._outputs (), None
262
263
yield assert_equal , DerivedInterface ._get_filecopy_info ()[0 ]['key' ], 'woo'
263
264
yield assert_true , DerivedInterface ._get_filecopy_info ()[0 ]['copy' ]
You can’t perform that action at this time.
0 commit comments