Skip to content

Commit f53858d

Browse files
committed
Add negative tests for branch sorter
1 parent 115d616 commit f53858d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cherry_picker/cherry_picker/test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,19 @@ def test_sorted_branch(os_path_exists, config, input_branches, sorted_branches):
7676
assert cp.sorted_branches == sorted_branches
7777

7878

79+
@pytest.mark.parametrize('input_branches', [
80+
(['3.1', '2.7', '3.x10', '3.6', '']),
81+
(['stable-3.1', 'lts-2.7', '3.10-other', 'smth3.6else', 'invalid']),
82+
])
83+
@mock.patch('os.path.exists')
84+
def test_invalid_branches(os_path_exists, config, input_branches):
85+
os_path_exists.return_value = True
86+
cp = CherryPicker('origin', '22a594a0047d7706537ff2ac676cdc0f1dcb329c',
87+
input_branches, config=config)
88+
with pytest.raises(ValueError):
89+
cp.sorted_branches
90+
91+
7992
@mock.patch('os.path.exists')
8093
def test_get_cherry_pick_branch(os_path_exists, config):
8194
os_path_exists.return_value = True

0 commit comments

Comments
 (0)