@@ -72,6 +72,58 @@ def test_as_dict(self):
72
72
}
73
73
self .assertEqual (expected , branch ._asdict ())
74
74
75
+ def test_with_args (self ):
76
+ branch = phase_branches .BranchSequence (
77
+ phase_branches .DiagnosisCondition .on_all (BranchDiagResult .SET ),
78
+ nodes = (run_phase ,),
79
+ name = 'name_{arg}' )
80
+ expected = phase_branches .BranchSequence (
81
+ phase_branches .DiagnosisCondition .on_all (BranchDiagResult .SET ),
82
+ nodes = (run_phase .with_args (arg = 1 ),),
83
+ name = 'name_1' )
84
+
85
+ self .assertEqual (expected , branch .with_args (arg = 1 ))
86
+
87
+ def test_with_plugs (self ):
88
+
89
+ class MyPlug (htf .BasePlug ):
90
+ pass
91
+
92
+ branch = phase_branches .BranchSequence (
93
+ phase_branches .DiagnosisCondition .on_all (BranchDiagResult .SET ),
94
+ nodes = (run_phase ,),
95
+ name = 'name_{my_plug.__name__}' )
96
+ expected = phase_branches .BranchSequence (
97
+ phase_branches .DiagnosisCondition .on_all (BranchDiagResult .SET ),
98
+ nodes = (run_phase .with_plugs (my_plug = MyPlug ),),
99
+ name = 'name_MyPlug' )
100
+
101
+ self .assertEqual (expected , branch .with_plugs (my_plug = MyPlug ))
102
+
103
+ def test_load_code_info (self ):
104
+ branch = phase_branches .BranchSequence (
105
+ phase_branches .DiagnosisCondition .on_all (BranchDiagResult .SET ),
106
+ nodes = (run_phase ,))
107
+ expected = phase_branches .BranchSequence (
108
+ phase_branches .DiagnosisCondition .on_all (BranchDiagResult .SET ),
109
+ nodes = (run_phase .load_code_info (),))
110
+
111
+ self .assertEqual (expected , branch .load_code_info ())
112
+
113
+ def test_apply_to_all_phases (self ):
114
+
115
+ def do_rename (phase ):
116
+ return _rename (phase , 'blah_blah' )
117
+
118
+ branch = phase_branches .BranchSequence (
119
+ phase_branches .DiagnosisCondition .on_all (BranchDiagResult .SET ),
120
+ nodes = (run_phase ,))
121
+ expected = phase_branches .BranchSequence (
122
+ phase_branches .DiagnosisCondition .on_all (BranchDiagResult .SET ),
123
+ nodes = (do_rename (run_phase ),))
124
+
125
+ self .assertEqual (expected , branch .apply_to_all_phases (do_rename ))
126
+
75
127
76
128
class BranchSequenceIntegrationTest (htf_test .TestCase ):
77
129
0 commit comments