def test_conditional_evaluation(self): select_xml = XML( '''<param name="always_true" type="select"><option value="true">True</option></param>''' ) parameter = SelectToolParameter(self.tool, select_xml) conditional = Conditional() conditional.name = "c" conditional.test_param = parameter when = ConditionalWhen() when.inputs = {"thresh": self.tool.test_thresh_param()} when.value = "true" conditional.cases = [when] self.tool.set_params({"c": conditional}) self.job.parameters = [ JobParameter( name="c", value= '''{"thresh": 4, "always_true": "true", "__current_case__": 0}''' ) ] self.tool._command_line = "prog1 --thresh=${c.thresh} --test_param=${c.always_true}" self._set_compute_environment() command_line, extra_filenames = self.evaluator.build() self.assertEquals(command_line, "prog1 --thresh=4 --test_param=true")
def test_conditional_evaluation( self ): select_xml = XML('''<param name="always_true" type="select"><option value="true">True</option></param>''') parameter = SelectToolParameter( self.tool, select_xml ) conditional = Conditional() conditional.name = "c" conditional.test_param = parameter when = ConditionalWhen() when.inputs = { "thresh": self.tool.test_thresh_param() } when.value = "true" conditional.cases = [ when ] self.tool.set_params( { "c": conditional } ) self.job.parameters = [ JobParameter( name="c", value='''{"thresh": 4, "always_true": "true", "__current_case__": 0}''' ) ] self.tool._command_line = "prog1 --thresh=${c.thresh} --test_param=${c.always_true}" self._set_compute_environment() command_line, extra_filenames, _ = self.evaluator.build( ) self.assertEquals( command_line, "prog1 --thresh=4 --test_param=true" )