@@ -628,6 +628,41 @@ def flag_value_for(value: str, profile: str = "23.02"):
628628 assert flag_value_for ("-" ) is False
629629
630630
631+ def test_legacy_numeric_empty_test_values_are_none ():
632+ # An optional numeric param given value="" in a test is the legacy "not set" convention.
633+ # The test-case builder must emit None rather than raising on int("")/float(""). Regression
634+ # for async failures on macs2 (macs2_predictd tsize), ucsc_blat (blat), vegan
635+ # (vegan_rarefaction sample_size), and vsearch (dereplication topn).
636+ tool_template = """
637+ <tool id="numeric_legacy_empty" name="numeric_legacy_empty" version="1.0.0" profile="23.02">
638+ <command>echo</command>
639+ <inputs>
640+ <param name="int_param" type="integer" value="" optional="true" />
641+ <param name="float_param" type="float" value="" optional="true" />
642+ </inputs>
643+ <outputs />
644+ <tests>
645+ <test><param name="int_param" value="{int_value}" /><param name="float_param" value="{float_value}" /></test>
646+ </tests>
647+ </tool>
648+ """
649+
650+ def state_for (int_value : str , float_value : str ):
651+ tool_source = raw_xml_tool_source (tool_template .format (int_value = int_value , float_value = float_value ))
652+ parsed_tool = parse_tool (tool_source )
653+ test_case = tool_source .parse_tests_to_dict ()["tests" ][0 ]
654+ return case_state (test_case , parsed_tool .inputs , tool_source .parse_profile ()).tool_state .input_state
655+
656+ # value="" -> None (was: raised int("")/float(""))
657+ empty = state_for ("" , "" )
658+ assert empty ["int_param" ] is None
659+ assert empty ["float_param" ] is None
660+ # non-empty values still coerce normally
661+ typed = state_for ("5" , "2.5" )
662+ assert typed ["int_param" ] == 5
663+ assert typed ["float_param" ] == 2.5
664+
665+
631666def test_legacy_unqualified_conditional_discriminator_in_section_is_resolved ():
632667 # A conditional inside a section may have its name elided in the test, with the
633668 # discriminator given directly under the section (e.g. <section name="adv">
0 commit comments