forked from MIT-Emerging-Talent/ET6-practice-code-review
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
import unittest | ||
from is_palindrome import is_palindrome | ||
|
||
|
||
class TestIsPalindrome(unittest.TestCase): | ||
"""Test the is_palindrome function.""" | ||
|
||
def test_empty_string(self): | ||
"""It should return True for an empty string.""" | ||
self.assertTrue(is_palindrome("")) | ||
|
||
def test_single_character(self): | ||
"""It should return True for single character strings.""" | ||
self.assertTrue(is_palindrome("a")) | ||
|
||
def test_simple_palindrome(self): | ||
"""It should return True for simple palindromes.""" | ||
self.assertTrue(is_palindrome("level")) | ||
self.assertTrue(is_palindrome("radar")) | ||
|
||
def test_non_palindrome(self): | ||
"""It should return False for non-palindromes.""" | ||
self.assertFalse(is_palindrome("hello")) | ||
self.assertFalse(is_palindrome("world")) | ||
|
||
def test_mixed_case_palindrome(self): | ||
"""It should handle mixed case palindromes.""" | ||
self.assertTrue(is_palindrome("RaceCar")) | ||
|
||
def test_palindrome_with_spaces(self): | ||
"""It should handle palindromes with spaces.""" | ||
self.assertTrue(is_palindrome("A man a plan a canal Panama")) | ||
|
||
def test_not_a_string(self): | ||
"""It should raise AssertionError for non-string input.""" | ||
with self.assertRaises(AssertionError): | ||
is_palindrome(12321) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
|
||
|