-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_Kyu07.py
92 lines (76 loc) · 3.33 KB
/
test_Kyu07.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import unittest
import Kyu07
class TestAccum(unittest.TestCase):
"""
Test the accum function from the 7th Kyu library
"""
def test_accum_01(self):
result = Kyu07.accum("abcd")
self.assertEqual(result, "A-Bb-Ccc-Dddd")
def test_accum_02(self):
result = Kyu07.accum("RqaEzty")
self.assertEqual(result, "R-Qq-Aaa-Eeee-Zzzzz-Tttttt-Yyyyyyy")
def test_accum_03(self):
result = Kyu07.accum("cwAt")
self.assertEqual(result, "C-Ww-Aaa-Tttt")
def test_accum_04(self):
"""
Test output for various strings as per below
"""
self.assertEqual(Kyu07.accum("ZpglnRxqenU"),
"Z-Pp-Ggg-Llll-Nnnnn-Rrrrrr-Xxxxxxx-Qqqqqqqq-Eeeeeeeee-Nnnnnnnnnn-Uuuuuuuuuuu")
self.assertEqual(Kyu07.accum("NyffsGeyylB"),
"N-Yy-Fff-Ffff-Sssss-Gggggg-Eeeeeee-Yyyyyyyy-Yyyyyyyyy-Llllllllll-Bbbbbbbbbbb")
self.assertEqual(Kyu07.accum("MjtkuBovqrU"),
"M-Jj-Ttt-Kkkk-Uuuuu-Bbbbbb-Ooooooo-Vvvvvvvv-Qqqqqqqqq-Rrrrrrrrrr-Uuuuuuuuuuu")
self.assertEqual(Kyu07.accum("EvidjUnokmM"),
"E-Vv-Iii-Dddd-Jjjjj-Uuuuuu-Nnnnnnn-Oooooooo-Kkkkkkkkk-Mmmmmmmmmm-Mmmmmmmmmmm")
self.assertEqual(Kyu07.accum("HbideVbxncC"),
"H-Bb-Iii-Dddd-Eeeee-Vvvvvv-Bbbbbbb-Xxxxxxxx-Nnnnnnnnn-Cccccccccc-Ccccccccccc")
class TestExplode(unittest.TestCase):
"""
Test the explode function from the 7th Kyu library
"""
def test_explode_01(self):
result = Kyu07.explode("312")
self.assertEqual(result, "333122")
def test_explode_02(self):
result = Kyu07.explode("102269")
self.assertEqual(result, "12222666666999999999")
def test_accum_03(self):
"""
Test output for various strings as per below
"""
self.assertEqual(Kyu07.explode("0"),"")
self.assertEqual(Kyu07.explode("000"),"")
self.assertEqual(Kyu07.explode("123"),"122333")
self.assertEqual(Kyu07.explode("01001"),"11")
self.assertEqual(Kyu07.explode("54321"),"555554444333221")
class TestFind_next_square(unittest.TestCase):
"""
Test the find_next_square function from the 7th Kyu library
"""
def test_find_next_01(self):
self.assertEqual(Kyu07.find_next_square(121), 144)
def test_find_next_02(self):
self.assertEqual(Kyu07.find_next_square(625), 676)
def test_find_next_03(self):
self.assertEqual(Kyu07.find_next_square(114), -1)
class TestIs_isogram(unittest.TestCase):
"""
Test the find_next_square function from the 7th Kyu library
"""
def test_is_isogram_01(self):
self.assertEqual(Kyu07.is_isogram("Dermatoglyphics"), True)
def test_is_isogram_02(self):
self.assertEqual(Kyu07.is_isogram("aba"), False)
def test_is_isogram_03(self):
self.assertEqual(Kyu07.is_isogram("moOse"), False)
def test_is_isogram_04(self):
self.assertEqual(Kyu07.is_isogram(""), True)
def test_is_isogram_05(self):
self.assertEqual(Kyu07.is_isogram("isogram"), True)
if __name__ == '__main__':
unittest.main()
# suite = unittest.TestLoader().loadTestsFromTestCase(TestAccum)
# unittest.TextTestRunner(verbosity=2).run(suite)