-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
52 lines (43 loc) · 1.25 KB
/
tests.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
from hashgen import good_tag
import unittest
class TestGoodTag(unittest.TestCase):
'''
Test cases for ``good_tag``.
'''
def test_pronoun_us(self):
'''
Tests that the tag "us", when a pronoun, should be rejected.
'''
self.assertEqual(good_tag('us', 'PRP', []), False)
def test_name_us(self):
'''
Tests that the tag "us", when a proper name (as in "the U.S."), should be accepted.
'''
self.assertEqual(good_tag('us', 'NNP', []), True)
def test_letters_only(self):
'''
Tests that a tag with only letters should be accepted.
'''
self.assertEqual(good_tag('route', '', []), True)
def test_numbers_only(self):
'''
Tests that a tag with only numbers should be rejected.
'''
self.assertEqual(good_tag('66', '', []), False)
def test_aplha_numeric(self):
'''
Tests that a tag with mixed letters and numbers should be accepted.
'''
self.assertEqual(good_tag('route66', '', []), True)
def test_is_stopword(self):
'''
Tests that a black-listed tag should be rejected.
'''
self.assertEqual(good_tag('route', '', ['route']), False)
def test_not_stopword(self):
'''
Tests that a non-black-listed tag should be accepted.
'''
self.assertEqual(good_tag('route', '', []), True)
if __name__ == "__main__":
unittest.main()