-
Notifications
You must be signed in to change notification settings - Fork 0
/
tester.py
74 lines (58 loc) · 1.77 KB
/
tester.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
from model.schedule import Schedule
from model.user import User
from model.course import Course
from model.event import Event
from model.event_time import EventTime
from model.data import Data
import time
import datetime
import pickle
def test1():
print("Test 1:")
will = User("Will", Schedule())
print(will)
def test2():
print("Test 2:")
reynaldo = User("Reynaldo", Schedule())
reynaldo.schedule.add_course(Course("CSCI141", EventTime(("Mon"), 1000, 1200), "GOL"))
print(reynaldo)
def test3():
print("Test 3:")
michael = User("Michael", Schedule())
michael.schedule.add_course(Course("CSCI140", EventTime(("Mon", "Wed", "Fri"), 1200, 1400), "GOL"))
print(michael.schedule.courses["CSCI140"].time.in_time(1300)) # True
michael.schedule.add_event(Event("Skate", EventTime(("Mon"), 1800, 1900)))
print(michael)
def test4():
data = Data()
data.add_user(123456, 'Will', User("Will", Schedule()))
[print('%s: %s\n' % (k, v)) for k, v in data.db['users'].items()]
print(data.db)
# print(data.db['users']['Will'].schedule.events['Skate'].time.in_time(data.db['users']['Michael'].schedule.courses['CSCI140'].time.start))
#print(data.db)
data.write_data()
#print(data.db)
#data.read_data()
#print(data.db)
def test5():
print(EventTime.parse_time("2:00 AM"))
print(EventTime.parse_time("2:40 PM"))
print(EventTime.parse_time("4 AM"))
def test6():
objects = []
with (open("db.data", "rb")) as openfile:
while True:
try:
objects.append(pickle.load(openfile))
except EOFError:
break
print(objects)
def main():
# test1()
# test2()
# test3()
# test4()
# test5()
test6()
if __name__ == "__main__":
main()