Skip to content

Commit 4616f16

Browse files
committed
fix(tests): add more test cases to meet minimum requirement of 10
1 parent 410e3f8 commit 4616f16

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

leetcode/palindrome_partitioning/test_solution.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,23 @@ def setup_method(self):
1111
self.solution = Solution()
1212

1313
@logged_test
14-
@pytest.mark.parametrize("s, expected", [("aab", [["a", "a", "b"], ["aa", "b"]]), ("a", [["a"]])])
14+
@pytest.mark.parametrize(
15+
"s, expected",
16+
[
17+
("aab", [["a", "a", "b"], ["aa", "b"]]),
18+
("a", [["a"]]),
19+
("ab", [["a", "b"]]),
20+
("aa", [["a", "a"], ["aa"]]),
21+
("abc", [["a", "b", "c"]]),
22+
("aba", [["a", "b", "a"], ["aba"]]),
23+
("aaa", [["a", "a", "a"], ["a", "aa"], ["aa", "a"], ["aaa"]]),
24+
("abba", [["a", "b", "b", "a"], ["a", "bb", "a"], ["abba"]]),
25+
("zz", [["z", "z"], ["zz"]]),
26+
("efe", [["e", "f", "e"], ["efe"]]),
27+
("xyx", [["x", "y", "x"], ["xyx"]]),
28+
("noon", [["n", "o", "o", 'n'], ['n', 'oo', 'n'], ['noon']]),
29+
],
30+
)
1531
def test_partition(self, s: str, expected: list[list[str]]):
1632
result = run_partition(Solution, s)
1733
assert_partition(result, expected)

leetcode_py/cli/resources/leetcode/json/problems/palindrome_partitioning.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,20 @@
5858
"signature": "(self, s: str, expected: list[list[str]])",
5959
"parametrize": "s, expected",
6060
"test_cases": {
61-
"list": ["('aab', [['a', 'a', 'b'], ['aa', 'b']])", "('a', [['a']])"]
61+
"list": [
62+
"('aab', [['a', 'a', 'b'], ['aa', 'b']])",
63+
"('a', [['a']])",
64+
"('ab', [['a', 'b']])",
65+
"('aa', [['a', 'a'], ['aa']])",
66+
"('abc', [['a', 'b', 'c']])",
67+
"('aba', [['a', 'b', 'a'], ['aba']])",
68+
"('aaa', [['a', 'a', 'a'], ['a', 'aa'], ['aa', 'a'], ['aaa']])",
69+
"('abba', [['a', 'b', 'b', 'a'], ['a', 'bb', 'a'], ['abba']])",
70+
"('zz', [['z', 'z'], ['zz']])",
71+
"('efe', [['e', 'f', 'e'], ['efe']])",
72+
"('xyx', [['x', 'y', 'x'], ['xyx']])",
73+
"('noon', [['n', 'o', 'o', 'n'], ['n', 'oo', 'n'], ['noon']])"
74+
]
6275
},
6376
"body": " result = run_partition(Solution, s)\n assert_partition(result, expected)"
6477
}
@@ -68,4 +81,4 @@
6881
"playground_setup": "# Example test case\ns = 'aab'\nexpected = [['a', 'a', 'b'], ['aa', 'b']]",
6982
"playground_run": "result = run_partition(Solution, s)\nresult",
7083
"playground_assert": "assert_partition(result, expected)"
71-
}
84+
}

0 commit comments

Comments
 (0)