Debian Codegraph @

git_delete_merged_branches/tests/test_without.py

raw symbols SCIP
1 # Copyright (C) 2026 Sebastian Pipping <[email protected]>
2 # Licensed under GPL v3 or later
3
4 from unittest import TestCase
5
6 from parameterized import parameterized
7
8 from .._without import without
9
10
11 class WithoutTest(TestCase):
12 A = "A"
13 B = "B"
14 C = "C"
15 D = "D"
16
17 @parameterized.expand(
18 [
19 ("empty container", [A, B], [], []),
20 ("empty needle", [], [C, D], [C, D]),
21 ("empty needle, empty container", [], [], []),
22 ("no matches", [A, B], [C, D], [C, D]),
23 ("whole container matched", [A, B], [A, B], []),
24 ("whole container matched, multiple", [A, B], [A, B, A, B], []),
25 ("needle head match", [A, B], [A, C, B], [A, C, B]),
26 ("needle head match, followed by match", [A, B], [A, A, A, B], [A, A]),
27 ("match at the start", [A, B], [A, B, C], [C]),
28 ("match at the end", [A, B], [C, A, B], [C]),
29 ("match in the middle", [A, B], [C, A, B, D], [C, D]),
30 ("in between two matches", [A, B], [A, B, C, A, B], [C]),
31 ("surrounding two matches", [A, B], [C, A, B, D, A, B, C], [C, D, C]),
32 ]
33 )
34 def test(self, _label, needle, container, expected):
35 self.assertEqual(without(needle, container), expected)