Merge pull request #121 from jmchilton/input_casting

Improved Cheetah type casting for int/float values.
This commit is contained in:
Dannon Baker
2015-04-17 12:10:10 -04:00
3 changed files with 35 additions and 0 deletions
+6
View File
@@ -98,6 +98,12 @@ class InputValueWrapper( ToolParameterValueWrapper ):
def __getattr__( self, key ):
return getattr( self.value, key )
def __int__(self):
return int(str(self))
def __float__(self):
return float(str(self))
class SelectToolParameterWrapper( ToolParameterValueWrapper ):
"""
+27
View File
@@ -0,0 +1,27 @@
<tool id="cheetah_casting" name="cheetah_casting" version="1.0.0">
<command>
#set $int_val_inc = int($inttest) + 1
#set $float_val_inc = float($floattest) + 1
echo $int_val_inc >> $out_file1;
echo $float_val_inc >> $out_file1;
</command>
<inputs>
<param name="inttest" value="1" type="integer" />
<param name="floattest" value="1.0" type="float" />
</inputs>
<outputs>
<data name="out_file1" format="txt" />
</outputs>
<tests>
<test>
<param name="inttest" value="1" />
<param name="floattest" value="2.5" />
<output name="out_file1">
<assert_contents>
<has_line line="2" />
<has_line line="3.5" />
</assert_contents>
</output>
</test>
</tests>
</tool>
@@ -52,6 +52,8 @@
<tool file="collection_optional_param.xml" />
<tool file="collection_split_on_column.xml" />
<tool file="cheetah_casting.xml" />
<tool file="multiple_versions_v01.xml" />
<tool file="multiple_versions_v02.xml" />