forked from AdaGold/encode_repeating_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_encode_repeating.py
More file actions
45 lines (24 loc) · 1.05 KB
/
Copy pathtest_encode_repeating.py
File metadata and controls
45 lines (24 loc) · 1.05 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
from encode_repeating import encode_repeating
# Basic Tests
def test_encode_repeating_with_repeating_characters():
test_string = "aaabbbbbcccc"
assert encode_repeating(test_string) == "a3b5c4"
def test_encode_repeating_with_single_characters():
test_string = "xxxyttttgeee"
assert encode_repeating(test_string) == "x3yt4ge3"
def test_encode_repeating_with_single_and_double_characters():
test_string = "ddbbfffgjjjj"
assert encode_repeating(test_string) == "ddbbf3gj4"
# Edge Cases
def test_encode_repeating_returns_unmodified_with_empty_string():
test_string = ""
assert encode_repeating(test_string) == ""
def test_encode_repeating_returns_unmodified_with_None():
test_string = None
assert encode_repeating(test_string) is None
def test_encode_repeating_with_no_consecutive_repeating_characters():
test_string = "aeiou"
assert encode_repeating(test_string) == "aeiou"
def test_encode_repeating_with_repeating_spaces():
test_string = "hi there"
assert encode_repeating(test_string) == "hi 4there"