-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_longest_palindrome.py
More file actions
46 lines (33 loc) · 1.12 KB
/
test_longest_palindrome.py
File metadata and controls
46 lines (33 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import unittest
from algorithms.two_pointers.palindrome import (
longest_palindrome_one,
longest_palindrome_two,
)
class LongestPalindromeV1TestCases(unittest.TestCase):
def test_longest_palindrome_one(self):
"""Should return 7 for s = abccccdd"""
s = "abccccdd"
actual = longest_palindrome_one(s)
expected = 7
self.assertEqual(expected, actual)
def test_longest_palindrome_two(self):
"""Should return 1 for s = a"""
s = "a"
actual = longest_palindrome_one(s)
expected = 1
self.assertEqual(expected, actual)
class LongestPalindromeV2TestCases(unittest.TestCase):
def test_longest_palindrome_one(self):
"""Should return 7 for s = abccccdd"""
s = "abccccdd"
actual = longest_palindrome_two(s)
expected = 7
self.assertEqual(expected, actual)
def test_longest_palindrome_two(self):
"""Should return 1 for s = a"""
s = "a"
actual = longest_palindrome_two(s)
expected = 1
self.assertEqual(expected, actual)
if __name__ == "__main__":
unittest.main()