Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(tests): add more test cases to meet minimum requirement of 10
  • Loading branch information
shravnchandr committed Nov 30, 2025
commit 4616f16c7656d3699e4c686b21df0258b2ca36d9
18 changes: 17 additions & 1 deletion leetcode/palindrome_partitioning/test_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,23 @@ def setup_method(self):
self.solution = Solution()

@logged_test
@pytest.mark.parametrize("s, expected", [("aab", [["a", "a", "b"], ["aa", "b"]]), ("a", [["a"]])])
@pytest.mark.parametrize(
"s, expected",
[
("aab", [["a", "a", "b"], ["aa", "b"]]),
("a", [["a"]]),
("ab", [["a", "b"]]),
("aa", [["a", "a"], ["aa"]]),
("abc", [["a", "b", "c"]]),
("aba", [["a", "b", "a"], ["aba"]]),
("aaa", [["a", "a", "a"], ["a", "aa"], ["aa", "a"], ["aaa"]]),
("abba", [["a", "b", "b", "a"], ["a", "bb", "a"], ["abba"]]),
("zz", [["z", "z"], ["zz"]]),
("efe", [["e", "f", "e"], ["efe"]]),
("xyx", [["x", "y", "x"], ["xyx"]]),
("noon", [["n", "o", "o", 'n'], ['n', 'oo', 'n'], ['noon']]),
],
)
def test_partition(self, s: str, expected: list[list[str]]):
result = run_partition(Solution, s)
assert_partition(result, expected)
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,20 @@
"signature": "(self, s: str, expected: list[list[str]])",
"parametrize": "s, expected",
"test_cases": {
"list": ["('aab', [['a', 'a', 'b'], ['aa', 'b']])", "('a', [['a']])"]
"list": [
"('aab', [['a', 'a', 'b'], ['aa', 'b']])",
"('a', [['a']])",
"('ab', [['a', 'b']])",
"('aa', [['a', 'a'], ['aa']])",
"('abc', [['a', 'b', 'c']])",
"('aba', [['a', 'b', 'a'], ['aba']])",
"('aaa', [['a', 'a', 'a'], ['a', 'aa'], ['aa', 'a'], ['aaa']])",
"('abba', [['a', 'b', 'b', 'a'], ['a', 'bb', 'a'], ['abba']])",
"('zz', [['z', 'z'], ['zz']])",
"('efe', [['e', 'f', 'e'], ['efe']])",
"('xyx', [['x', 'y', 'x'], ['xyx']])",
"('noon', [['n', 'o', 'o', 'n'], ['n', 'oo', 'n'], ['noon']])"
]
},
"body": " result = run_partition(Solution, s)\n assert_partition(result, expected)"
}
Expand All @@ -68,4 +81,4 @@
"playground_setup": "# Example test case\ns = 'aab'\nexpected = [['a', 'a', 'b'], ['aa', 'b']]",
"playground_run": "result = run_partition(Solution, s)\nresult",
"playground_assert": "assert_partition(result, expected)"
}
}