-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
test_no_meows.py
88 lines (69 loc) · 2.24 KB
/
test_no_meows.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
#!/usr/bin/env python
"""
Unit tests for no_meows.py
"""
import unittest
import no_meows
class TestIt(unittest.TestCase):
def sanity_check(self, word, out):
self.assertEqual(len(word), len(out))
def test_1_letter_word(self):
word = "I"
out = no_meows.space(word)
self.assertEqual(out, " ")
def test_2_letter_word(self):
word = "on"
out = no_meows.space(word)
self.sanity_check(word, out)
self.assertEqual(out, " ")
def test_3_letter_word(self):
word = "The"
out = no_meows.space(word)
self.sanity_check(word, out)
self.assertEqual(out, " ")
def test_4_letter_word(self):
word = "book"
out = no_meows.space(word)
self.sanity_check(word, out)
self.assertEqual(out, " ")
def test_upper_4_letter_word(self):
word = "BOOK"
out = no_meows.space(word)
self.sanity_check(word, out)
self.assertEqual(out, " ")
def test_capped_4_letter_word(self):
word = "Book"
out = no_meows.space(word)
self.sanity_check(word, out)
self.assertEqual(out, " ")
def test_mixcapped_4_letter_word(self):
word = "BooK"
out = no_meows.space(word)
self.sanity_check(word, out)
self.assertEqual(out, " ")
def test_5_letter_word(self):
word = "clock"
out = no_meows.space(word)
self.sanity_check(word, out)
self.assertEqual(out, " ")
def test_6_letter_word(self):
word = "whales"
out = no_meows.space(word)
self.sanity_check(word, out)
self.assertEqual(out, " ")
def test_13_letter_word(self):
word = "Extraordinary"
out = no_meows.space(word)
self.sanity_check(word, out)
self.assertEqual(out, " ")
def test_line(self):
line = "On the bus"
out = no_meows.space_space(line, no_meows.space)
self.assertEqual(out, " ")
def test_line_punctuation(self):
line = "On the bus? On the bus."
out = no_meows.space_space(line, no_meows.space)
self.assertEqual(out, " ? .")
if __name__ == "__main__":
unittest.main()
# End of file