-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_pig_latin.py
57 lines (45 loc) · 1.76 KB
/
test_pig_latin.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
import pig_latin
import unittest
class TestPigLatin(unittest.TestCase):
"""test class for pig_latin.pig_latin_converter. """
# test words with consonant at the beginning
def test_with_consonant(self):
actual = pig_latin.pig_latin_converter("happy")
expected = "appyhay"
self.assertEqual(expected, actual)
def test_with_consonant2(self):
actual = pig_latin.pig_latin_converter("duck")
expected = "uckday"
self.assertEqual(expected, actual)
# test words with multiple consonants at the beginning
def test_with_consonants(self):
actual = pig_latin.pig_latin_converter("flow")
expected = "owflay"
self.assertEqual(expected, actual)
def test_with_consonants2(self):
actual = pig_latin.pig_latin_converter("fly")
expected = "flyay"
self.assertEqual(expected, actual)
# test words with vowels at the beginning
def test_with_vowel(self):
actual = pig_latin.pig_latin_converter("egg")
expected = "eggway"
self.assertEqual(expected, actual)
def test_with_vowel2(self):
actual = pig_latin.pig_latin_converter("inbox")
expected = "inboxway"
self.assertEqual(expected, actual)
def test_with_sentence(self):
actual = pig_latin.pig_latin_sentence("what the heck is this stuff")
expected = "atwhay ethay eckhay isway isthay uffstay "
self.assertEqual(expected, actual)
def test_with_sentence_special_sign(self):
actual = pig_latin.pig_latin_sentence("what the heck is this stuff?")
expected = "atwhay ethay eckhay isway isthay uffstay? "
self.assertEqual(expected, actual)
def test_with_sentence_special_sign(self):
actual = pig_latin.pig_latin_sentence("what the heck? is this stuff?")
expected = "atwhay ethay eckhay? isway isthay uffstay? "
self.assertEqual(expected, actual)
if __name__ == '__main__':
unittest.main(exit=False)