This commit is contained in:
Harivansh Rathi 2025-12-14 17:15:37 -05:00
parent 76062021e9
commit c548626d7f
13 changed files with 570 additions and 1 deletions

View file

@ -0,0 +1,44 @@
"""Tests for palindrome-checker."""
import pytest
from solution import is_palindrome
class TestBasicCases:
"""Test basic functionality with typical inputs."""
def test_simple_palindrome(self):
"""Test basic palindrome word."""
assert is_palindrome("racecar") == True
def test_sentence_palindrome(self):
"""Test palindrome with spaces and punctuation."""
assert is_palindrome("A man, a plan, a canal: Panama") == True
def test_not_palindrome(self):
"""Test non-palindrome string."""
assert is_palindrome("hello") == False
class TestEdgeCases:
"""Test edge cases and boundary conditions."""
def test_empty_string(self):
"""Test with empty input."""
assert is_palindrome("") == True
def test_single_character(self):
"""Test with single character."""
assert is_palindrome("a") == True
def test_only_spaces(self):
"""Test with only whitespace."""
assert is_palindrome(" ") == True
def test_mixed_case(self):
"""Test case insensitivity."""
assert is_palindrome("RaceCar") == True
def test_numbers_in_string(self):
"""Test with numbers."""
assert is_palindrome("12321") == True