-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtilTests.py
33 lines (26 loc) · 947 Bytes
/
UtilTests.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
from utils import *
import datetime as dt
import unittest
class UtilityTests(unittest.TestCase):
#def setUp(self):
#loader = DataLoader(index=True)
#self.DBI = dbi.DatabaseInterface()#host='hamm.cse.tamu.edu')
#Make and update and test if the query returns correct results
def testTimePeriodParser(self):
filename = 'geo.2012-01-01_08-51.txt.gz'
time_period = parseTimePeriod(filename)
expected_period = dt.datetime(2012,1,1,8,51)
self.assertTrue(time_period == expected_period)
def testWordFilter(self):
test_string = "@kiana_ashleyy happy b day enjoy! test. https://twitter.com/PaulOBrien/status/282534796482199552"
expected_words = ["happy", "day", "enjoy", "test"]
tokens = wordFilter(test_string.split())
msg = "".join(tokens)
for word in expected_words:
if word not in tokens:
#msg = msg
self.assertFalse(True, msg=tokens)
def main():
unittest.main()
if __name__=='__main__':
main()