Repository navigation
Expand file tree
/
Copy pathSurvMatch_test.py
More file actions
70 lines (52 loc) · 1.81 KB
/
Copy pathSurvMatch_test.py
File metadata and controls
70 lines (52 loc) · 1.81 KB
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
# Koray Amico Kulbay, Survey Matchmaking API, unit test
from SurvMatch import SurveyRes, MatchMake
from random import randint
def main():
tsurv = SurveyRes("test")
try:
tsurv.get("ads")
except NameError:
pass
tsurv.add("question1",1,4.5)
tsurv.add("question2", 1, 4.5)
tsurv.add("question3", 1, 4.5)
tsurv.add("question4", 1, 4.5)
tsurv.add("question5", 1, 4.5)
tsurv.add("question8", 1, 4.5)
#tsurv.display()
assert tsurv.get("question1") == ["question1",1,4.5]
tsurv.clear()
#tsurv.display()
tsurv.add("question1", 6, 10)
tsurv.remove("question1")
try:
tsurv.remove("question1")
except NameError:
pass
tsurv.clear()
questions = ["quest1","quest2","quest3","quest4","quest5","quest6","quest7","quest8","quest9","quest10","quest11"]
answers = []
weights = []
for i in range(len(questions)):
weights.append(randint(5,15))
for i in range(7*len(questions)):
answers.append(randint(1,5))
psurv = SurveyRes("Pat.")
tsurv1 = SurveyRes("Th1.")
tsurv2 = SurveyRes("Th2.")
tsurv3 = SurveyRes("Th3.")
tsurv4 = SurveyRes("Th4.")
tsurv5 = SurveyRes("Th5.")
tsurv6 = SurveyRes("Th6.")
for i in range(len(questions)):
psurv.add(questions[i],answers[i],weights[i])
tsurv1.add(questions[i],answers[i+1],weights[i])
tsurv2.add(questions[i],answers[i+2],weights[i])
tsurv3.add(questions[i],answers[i+3],weights[i])
tsurv4.add(questions[i],answers[i+4],weights[i])
tsurv5.add(questions[i],answers[i+5],weights[i])
tsurv6.add(questions[i],answers[i+6],weights[i])
match = MatchMake()
match.create_match(psurv,[tsurv1,tsurv2,tsurv3,tsurv4,tsurv5,tsurv6])
tmatch = MatchMake()
if __name__ == '__main__': main()