-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtests.py
19 lines (12 loc) · 862 Bytes
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import unittest
from reddit import find_word_in_text, get_comment_reply
from smeagol import trigger_dictionary as smeagol_trigger_dictionary
class TestStringMethods(unittest.TestCase):
def test_find_word_in_text(self):
self.assertFalse(find_word_in_text("There are infinite numbers between 1 and 2, but none of them are 3.", "hobbits"))
self.assertTrue(find_word_in_text("Those darn **hobbits**.", "hobbits"))
self.assertTrue(find_word_in_text("Po-ta-toes", "Po-ta-toes"))
def test_get_comment_reply(self):
self.assertTrue(get_comment_reply("Protect the Hobbits!!", smeagol_trigger_dictionary) in smeagol_trigger_dictionary[("hobbits",)])
self.assertFalse(get_comment_reply("Where was Gondor when the Westfold fell?", smeagol_trigger_dictionary) in smeagol_trigger_dictionary[("hobbits",)])
unittest.main()