Skip to content

Commit 2f5f992

Browse files
committed
test(cli): shorten no_raise tests
1 parent aa82b98 commit 2f5f992

File tree

1 file changed

+12
-27
lines changed

1 file changed

+12
-27
lines changed

tests/test_cli.py

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -119,34 +119,19 @@ 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+
("1", [1]),
126+
("1,2,3", [1, 2, 3]),
127+
("NO_COMMITIZEN_FOUND,NO_COMMITS_FOUND,NO_PATTERN_MAP", [1, 3, 5]),
128+
("NO_COMMITIZEN_FOUND,2,NO_COMMITS_FOUND,4", [1, 2, 3, 4]),
129+
("NO_COMMITIZEN_FOUND,2,nothing,4", [1, 2, 4]),
130+
],
131+
)
132+
def test_parse_no_raise(input_str, expected_result):
148133
result = cli.parse_no_raise(input_str)
149-
assert result == [1, 2, 4]
134+
assert result == expected_result
150135

151136

152137
def test_unknown_args_raises(util: UtilFixture):

0 commit comments

Comments
 (0)