@@ -55,17 +55,14 @@ def test_TraitedSpec_tab_completion():
55
55
bet_nd = Node (fsl .BET (), name = 'bet' )
56
56
bet_interface = fsl .BET ()
57
57
bet_inputs = bet_nd .inputs .class_editable_traits ()
58
- bet_outputs = bet_nd .outputs .class_editable_traits ()
58
+ bet_outputs = bet_nd .outputs .class_editable_traits ()
59
59
60
60
# Check __all__ for bet node and interface inputs
61
- assert bet_nd .inputs .__all__ == [
62
- x for x in bet_inputs if not x == "__all__" ]
63
- assert bet_interface .inputs .__all__ == [
64
- x for x in bet_inputs if not x == "__all__" ]
61
+ assert bet_nd .inputs .__all__ == bet_inputs
62
+ assert bet_interface .inputs .__all__ == bet_inputs
65
63
66
64
# Check __all__ for bet node outputs
67
- assert bet_nd .outputs .__all__ == [
68
- x for x in bet_outputs if not x == "__all__" ]
65
+ assert bet_nd .outputs .__all__ == bet_outputs
69
66
70
67
71
68
@pytest .mark .skip
@@ -91,20 +88,26 @@ def test_DynamicTraitedSpec_tab_completion():
91
88
func_interface = Function (input_names = ["list_out" ],
92
89
output_names = ["out_file" ,"another_file" ],
93
90
function = extract_func )
94
- # Check __all__ for interface inputs
95
- assert func_interface .inputs .__all__ == func_interface ._input_names
96
-
97
91
# Define node
98
92
list_extract = Node (Function (
99
93
input_names = ["list_out" ],output_names = ["out_file" ],
100
94
function = extract_func ), name = "list_extract" )
101
95
96
+ # Check __all__ for interface inputs
97
+ expected_input = sorted (list_extract .inputs .editable_traits ())
98
+ assert (sorted (func_interface .inputs .__all__ ) == expected_input )
99
+
102
100
# Check __all__ for node inputs
103
- assert list_extract .inputs .__all__ == list_extract ._interface ._input_names
101
+ assert (sorted (list_extract .inputs .__all__ ) == expected_input )
102
+
104
103
# Check __all__ for node outputs
105
- outputs_dict = list_extract ._interface ._outputs ().get ().items ()
106
- outputs = [k for k ,v in outputs_dict if not k == "__all__" ]
107
- assert list_extract .outputs .__all__ == outputs
104
+ expected_output = sorted (list_extract .outputs .editable_traits ())
105
+ assert (sorted (list_extract .outputs .__all__ ) == expected_output )
106
+
107
+ # Add trait and retest
108
+ list_extract .outputs .add_trait ("added_out_trait" ,"val" )
109
+ expected_output = sorted (['added_out_trait' ,* expected_output ])
110
+ assert (sorted (list_extract .outputs .__all__ ) == expected_output )
108
111
109
112
110
113
def test_TraitedSpec_logic ():
0 commit comments