@@ -66,6 +66,24 @@ def test_biaflows_parsing(self, biaflows_descriptor):
6666 assert "Radius" in param_names
6767 assert "Threshold" in param_names
6868
69+ def test_biaflows_number_int_default_stays_integer (self , biaflows_descriptor ):
70+ """Number param with int default parses as type 'integer' with int default_value."""
71+ parsed = DescriptorParserFactory .parse_descriptor (biaflows_descriptor )
72+ radius = next (p for p in parsed .inputs if p .id == 'ij_radius' )
73+ assert radius .type == 'integer'
74+ assert isinstance (radius .default_value , int ), (
75+ f"default_value must be int, got { type (radius .default_value )} : { radius .default_value !r} "
76+ )
77+ assert radius .default_value == 5
78+
79+ def test_biaflows_number_float_default_stays_float (self , biaflows_descriptor ):
80+ """Number param with float default parses as type 'float' with float default_value."""
81+ parsed = DescriptorParserFactory .parse_descriptor (biaflows_descriptor )
82+ threshold = next (p for p in parsed .inputs if p .id == 'ij_threshold' )
83+ assert threshold .type == 'float'
84+ assert isinstance (threshold .default_value , float )
85+ assert threshold .default_value == - 0.5
86+
6987
7088class TestBiomeroSchemaParser :
7189 """Test cases for biomero-schema format parsing."""
@@ -232,14 +250,37 @@ def test_bilayers_value_choices_labels_none_when_labels_equal_values(self, bilay
232250 assert channel_axis .value_choices == [0 , 2 ]
233251 assert channel_axis .value_choices_labels is None
234252
253+ def test_bilayers_integer_radio_default_is_int_not_float (self , bilayers_descriptor ):
254+ """channel_axis default value is int, not float."""
255+ parsed = DescriptorParserFactory .parse_descriptor (bilayers_descriptor )
256+ channel_axis = next (p for p in parsed .inputs if p .id == 'channel_axis' )
257+ assert isinstance (channel_axis .default_value , int ), (
258+ f"default_value must be int, got { type (channel_axis .default_value )} : "
259+ f"{ channel_axis .default_value !r} "
260+ )
261+ assert channel_axis .default_value == 0
262+
263+ def test_bilayers_integer_radio_default_str_matches_string_choices (self , bilayers_descriptor ):
264+ """str(default_value) is in [str(c) for c in value_choices]."""
265+ parsed = DescriptorParserFactory .parse_descriptor (bilayers_descriptor )
266+ channel_axis = next (p for p in parsed .inputs if p .id == 'channel_axis' )
267+ str_choices = [str (c ) for c in channel_axis .value_choices ]
268+ assert str (channel_axis .default_value ) in str_choices , (
269+ f"str({ channel_axis .default_value !r} ) not in { str_choices } "
270+ )
271+
235272 def test_bilayers_value_choices_labels_survive_model_dump (self , bilayers_descriptor ):
236- """value-choices-labels must survive model_dump(by_alias=True) for downstream use ."""
273+ """value-choices-labels survives model_dump(by_alias=True)."""
237274 parsed = DescriptorParserFactory .parse_descriptor (bilayers_descriptor )
238275 dumped = parsed .model_dump (by_alias = True )
239276 pretrained = next (p for p in dumped ['inputs' ] if p ['id' ] == 'pretrained_model' )
240277 assert pretrained ['value-choices-labels' ] == ["Cyto" , "Nuclei" , "Cyto2" , "Ignore" ]
278+
279+
280+
281+ class TestDescriptorParserFactory :
241282 """Test cases for the descriptor parser factory."""
242-
283+
243284 def test_factory_parse_descriptor (self , biaflows_descriptor ,
244285 biomero_descriptor ):
245286 """Test end-to-end parsing through factory."""
0 commit comments