-
Notifications
You must be signed in to change notification settings - Fork 11
/
test.py
55 lines (37 loc) · 1.2 KB
/
test.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
import unittest
import petname
import petname.english
class TestAdjective(unittest.TestCase):
def test_works(self):
self.assertIn(petname.adjective(), petname.english.adjectives)
def test_alias(self):
self.assertIs(petname.adjective, petname.Adjective)
def test_len(self):
for l in range(4, 10):
self.assertLessEqual(len(petname.adjective(l)), l)
class TestAdverb(unittest.TestCase):
def test_works(self):
self.assertIn(petname.adverb(), petname.english.adverbs)
def test_alias(self):
self.assertIs(petname.adverb, petname.Adverb)
def test_len(self):
for l in range(4, 10):
self.assertLessEqual(len(petname.adverb(l)), l)
class TestName(unittest.TestCase):
def test_works(self):
self.assertIn(petname.name(), petname.english.names)
def test_alias(self):
self.assertIs(petname.name, petname.Name)
def test_len(self):
for l in range(4, 10):
self.assertLessEqual(len(petname.name(l)), l)
class TestGenerate(unittest.TestCase):
def test_works(self):
words = 3
sep = '-'
name = petname.generate(words, sep)
self.assertEqual(len(name.split(sep)), words)
def test_alias(self):
self.assertIs(petname.generate, petname.Generate)
if __name__ == '__main__':
unittest.main()