Skip to content

Commit e7369d7

Browse files
committed
update to is_palindrome
1 parent 82d002b commit e7369d7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Python/chapter02/2.6 - Palindrome/miguel_2.6_soln.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def reverse_linked_list(ll: LinkedList) -> LinkedList:
155155
return output_ll
156156

157157

158-
def palindrome_constant_space(ll: LinkedList) -> bool:
158+
def is_palindrome_constant_space(ll: LinkedList) -> bool:
159159
"""
160160
Same as the palindrome function below, but
161161
with constant space
@@ -178,7 +178,7 @@ def palindrome_constant_space(ll: LinkedList) -> bool:
178178
return True
179179

180180

181-
def palindrome(ll: LinkedList) -> bool:
181+
def is_palindrome(ll: LinkedList) -> bool:
182182
"""
183183
Given a linked list, this function will check if the
184184
linked list is a palindrome.
@@ -195,7 +195,7 @@ def palindrome(ll: LinkedList) -> bool:
195195
return ll == reverse_linked_list(ll)
196196

197197

198-
class TestPalindrome(unittest.TestCase):
198+
class TestIsPalindrome(unittest.TestCase):
199199

200200
def setUp(self):
201201
self.test_cases = [
@@ -233,13 +233,13 @@ def setUp(self):
233233
)
234234
]
235235

236-
def test_palindrome(self):
236+
def test_is_palindrome(self):
237237
for ll, expected in self.test_cases:
238-
self.assertEqual(palindrome(ll), expected, msg=ll)
238+
self.assertEqual(is_palindrome(ll), expected, msg=ll)
239239

240-
def test_palindrome_constant_space(self):
240+
def test_is_palindrome_constant_space(self):
241241
for ll, expected in self.test_cases:
242-
self.assertEqual(palindrome_constant_space(ll), expected, msg=ll)
242+
self.assertEqual(is_palindrome_constant_space(ll), expected, msg=ll)
243243

244244

245245
if __name__ == '__main__':

0 commit comments

Comments
 (0)