forked from AdaGold/palindrome_check_python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_palindrome_check.py
57 lines (30 loc) · 1.27 KB
/
test_palindrome_check.py
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
47
48
49
50
51
52
53
54
55
56
57
from palindrome_check import palindrome_check
# Basic Tests
def test_palindrome_check_with_odd_character_count_input():
test_string = "madam"
assert palindrome_check(test_string) is True
def test_palindrome_with_even_character_count_input():
test_string = "redder"
assert palindrome_check(test_string) is True
def test_palindrome_check_with_non_palindrome_input():
test_string = "empty"
assert palindrome_check(test_string) is False
def test_palindrome_check_with_empty_string_input():
test_string = ""
assert palindrome_check(test_string) is True
def test_palindrome_check_with_single_character_input():
test_string = "A"
assert palindrome_check(test_string) is True
# Edge cases
def test_palindrome_check_with_None_input():
test_string = None
assert palindrome_check(test_string) is False
def test_palindrome_check_ignores_single_spaces_in_input():
test_string = "nurses run"
assert palindrome_check(test_string) is True
def test_palindrome_check_ignores_multiple_spaces_in_input():
test_string = " pull up "
assert palindrome_check(test_string) is True
def test_palindrome_check_with_non_palindrome_including_whitespace():
test_string = " not in "
assert palindrome_check(test_string) is False