commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/39bc0ce6bb54/ Changeset: 39bc0ce6bb54 User: jmchilton Date: 2014-12-11 04:51:45+00:00 Summary: PEP-8 fixes for tool related stuff. Affected #: 1 file diff -r fc60d0eeb22b28a2e61db5c6ec672a3dc5663845 -r 39bc0ce6bb543238c1ee67fc5491e65ed16fe6f0 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1417,12 +1417,12 @@ def recurse_option_elems( cur_options, option_elems ): for option_elem in option_elems: selected = string_as_bool( option_elem.get( 'selected', False ) ) - cur_options.append( { 'name':option_elem.get( 'name' ), 'value': option_elem.get( 'value'), 'options':[], 'selected':selected } ) + cur_options.append( { 'name': option_elem.get( 'name' ), 'value': option_elem.get( 'value' ), 'options': [], 'selected': selected } ) recurse_option_elems( cur_options[-1]['options'], option_elem.findall( 'option' ) ) ToolParameter.__init__( self, tool, elem ) self.multiple = string_as_bool( elem.get( 'multiple', False ) ) self.display = elem.get( 'display', None ) - self.hierarchy = elem.get( 'hierarchy', 'exact' ) #exact or recurse + self.hierarchy = elem.get( 'hierarchy', 'exact' ) # exact or recurse self.separator = elem.get( 'separator', ',' ) from_file = elem.get( 'from_file', None ) if from_file: @@ -1430,7 +1430,7 @@ from_file = os.path.join( tool.app.config.tool_data_path, from_file ) elem = XML( "<root>%s</root>" % open( from_file ).read() ) self.is_dynamic = False - self.dynamic_options = elem.get( 'dynamic_options' , None ) + self.dynamic_options = elem.get( 'dynamic_options', None ) if self.dynamic_options: self.is_dynamic = True self.options = [] @@ -1509,17 +1509,18 @@ return form_builder.TextArea( self.name, value=value ) else: return form_builder.TextField( self.name, value=(value or "") ) - return form_builder.DrillDownField( self.name, self.multiple, self.display, self.refresh_on_change, self.get_options( trans, value, other_values ), value, refresh_on_change_values = self.refresh_on_change_values ) + return form_builder.DrillDownField( self.name, self.multiple, self.display, self.refresh_on_change, self.get_options( trans, value, other_values ), value, refresh_on_change_values=self.refresh_on_change_values ) def from_html( self, value, trans=None, other_values={} ): if self.need_late_validation( trans, other_values ): if self.multiple: - if value == '': #No option selected + if value == '': # No option selected value = None else: value = value.split( "\n" ) return UnvalidatedValue( value ) - if not value: return None + if not value: + return None if not isinstance( value, list ): value = [value] if not( self.repeat ) and len( value ) > 1: @@ -1540,8 +1541,10 @@ if value == option['value']: return option rval = get_base_option( value, option['options'] ) - if rval: return rval - return None #not found + if rval: + return rval + return None # not found + def recurse_option( option_list, option ): if not option['options']: option_list.append( option['value'] ) @@ -1931,7 +1934,7 @@ if value in [None, "None"]: return None if isinstance( value, str ) and value.find( "," ) > 0: - value = [ int( value_part ) for value_part in value.split( "," ) ] + value = [ int( value_part ) for value_part in value.split( "," ) ] if isinstance( value, list ): rval = [] for single_value in value: @@ -2368,6 +2371,7 @@ # return final dictionary return d + class HiddenDataToolParameter( HiddenToolParameter, DataToolParameter ): """ Hidden parameter that behaves as a DataToolParameter. As with all hidden https://bitbucket.org/galaxy/galaxy-central/commits/b9c5b028e389/ Changeset: b9c5b028e389 User: jmchilton Date: 2014-12-11 04:51:45+00:00 Summary: More testing for parameter parsing. Affected #: 1 file diff -r 39bc0ce6bb543238c1ee67fc5491e65ed16fe6f0 -r b9c5b028e389678c1a073f11c9aba5104ae17e89 test/unit/tools/test_parameter_parsing.py --- a/test/unit/tools/test_parameter_parsing.py +++ b/test/unit/tools/test_parameter_parsing.py @@ -177,9 +177,11 @@ <option value="b" selected="true">B</option></param> """) + assert param.display is None assert param.multiple is True assert param.name == "selectp" assert param.type == "select" + assert param.separator == "," assert param.options is None assert param.dynamic_options is None @@ -196,7 +198,7 @@ def test_select_dynamic(self): param = self._parameter_for(xml=""" - <param name="selectp" type="select" dynamic_options="cow"> + <param name="selectp" type="select" dynamic_options="cow" display="checkboxes" separator="moo"></param> """) assert param.multiple is False @@ -206,6 +208,9 @@ # assert not param.static_options assert param.is_dynamic + assert param.display == "checkboxes" + assert param.separator == "moo" + def test_select_options_from(self): param = self._parameter_for(xml=""" <param name="selectp" type="select"> @@ -229,8 +234,79 @@ assert param.name == "genomep" assert param.static_options - # Column and Data have sufficient test coverage in - # other modules. + def test_column_params(self): + param = self._parameter_for(xml=""" + <param name="col1" type="data_column" data_ref="input1"> + </param> + """) + assert param.data_ref == "input1" + assert param.usecolnames is False + assert param.force_select is True + assert param.numerical is False + + param = self._parameter_for(xml=""" + <param name="col1" type="data_column" data_ref="input1" use_header_names="true" numerical="true" force_select="false"> + </param> + """) + assert param.data_ref == "input1" + assert param.usecolnames is True + assert param.force_select is False + assert param.numerical is True + + def test_data_param_no_validation(self): + param = self._parameter_for(xml=""" + <param name="input" type="data"> + </param> + """) + assert len(param.validators) == 1 + param = self._parameter_for(xml=""" + <param name="input" type="data" no_validation="true"> + </param> + """) + assert len(param.validators) == 0 + + def test_data_param_dynamic_options(self): + param = self._parameter_for(xml=""" + <param name="input" type="data" /> + """) + assert param.options is None + assert param.options_filter_attribute is None + + param = self._parameter_for(xml=""" + <param name="input" type="data"> + <options from_data_table="cow"> + </options> + </param> + """) + assert param.options is not None + assert param.options_filter_attribute is None + + param = self._parameter_for(xml=""" + <param name="input" type="data"> + <options from_data_table="cow" options_filter_attribute="cow"> + </options> + </param> + """) + assert param.options is not None + assert param.options_filter_attribute == "cow" + + def test_conversions(self): + param = self._parameter_for(xml=""" + <param name="input" type="data" /> + """) + assert param.conversions == [] + + param = self._parameter_for(xml=""" + <param name="input" type="data"> + <conversion name="foo" type="txt" /> + <conversion name="foo2" type="bam" /> + </param> + """) + assert param.conversions[0][0] == "foo" + assert param.conversions[0][1] == "txt" + assert param.conversions[1][0] == "foo2" + assert param.conversions[1][1] == "bam" + def test_drilldown(self): param = self._parameter_for(xml=""" <param name="some_name" type="drill_down" display="checkbox" hierarchy="recurse" multiple="true"> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org