@@ -119,34 +119,31 @@ def test_commitizen_excepthook_no_raises(capsys):
119119 assert excinfo .value .code == 0
120120
121121
122- def test_parse_no_raise_single_integer ():
123- input_str = "1"
124- result = cli .parse_no_raise (input_str )
125- assert result == [1 ]
126-
127-
128- def test_parse_no_raise_integers ():
129- input_str = "1,2,3"
130- result = cli .parse_no_raise (input_str )
131- assert result == [1 , 2 , 3 ]
132-
133-
134- def test_parse_no_raise_error_code ():
135- input_str = "NO_COMMITIZEN_FOUND,NO_COMMITS_FOUND,NO_PATTERN_MAP"
136- result = cli .parse_no_raise (input_str )
137- assert result == [1 , 3 , 5 ]
138-
139-
140- def test_parse_no_raise_mix_integer_error_code ():
141- input_str = "NO_COMMITIZEN_FOUND,2,NO_COMMITS_FOUND,4"
142- result = cli .parse_no_raise (input_str )
143- assert result == [1 , 2 , 3 , 4 ]
144-
145-
146- def test_parse_no_raise_mix_invalid_arg_is_skipped ():
147- input_str = "NO_COMMITIZEN_FOUND,2,nothing,4"
122+ @pytest .mark .parametrize (
123+ "input_str, expected_result" ,
124+ [
125+ pytest .param ("1" , [1 ], id = "single_code" ),
126+ pytest .param ("1,2,3" , [1 , 2 , 3 ], id = "multiple_number_codes" ),
127+ pytest .param (
128+ "NO_COMMITIZEN_FOUND,NO_COMMITS_FOUND,NO_PATTERN_MAP" ,
129+ [1 , 3 , 5 ],
130+ id = "string_codes" ,
131+ ),
132+ pytest .param (
133+ "NO_COMMITIZEN_FOUND,2,NO_COMMITS_FOUND,4" ,
134+ [1 , 2 , 3 , 4 ],
135+ id = "number_and_string_codes" ,
136+ ),
137+ pytest .param (
138+ "NO_COMMITIZEN_FOUND,2,nothing,4" ,
139+ [1 , 2 , 4 ],
140+ id = "number_and_string_codes_and_invalid_code" ,
141+ ),
142+ ],
143+ )
144+ def test_parse_no_raise (input_str , expected_result ):
148145 result = cli .parse_no_raise (input_str )
149- assert result == [ 1 , 2 , 4 ]
146+ assert result == expected_result
150147
151148
152149def test_unknown_args_raises (util : UtilFixture ):
0 commit comments