-
Notifications
You must be signed in to change notification settings - Fork 0
/
topicTest.py
35 lines (29 loc) · 1.36 KB
/
topicTest.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
'''
Test of Topic class with related Question and Exercise
'''
from topic import Topic
from exercise import Exercise
from topicSet import TopicSet
import json
print "Test for Topic..."
mainTopic = Topic("Simple Topic A", 3600)
mainTopic.addTheory("Simple theory about the Topic A of the Subject.")
mainTopic.addTheory("Complex theory about the Topic A of the Subject.")
ex0 = Exercise("Notes for Exercise 0")
ex0.addQuestion("Question 0.1", ["1"], [1.0])
ex1 = Exercise("Notes for Exercise 1")
ex1.addQuestion("Question 1.1", ["one", "two", "three", "four"], [0.0, 0.2, 1, "0.5"])
ex1.addQuestion("Question 1.2", ["one", "two"], [1.0]).addQuestion("Question 1.3", [1,2,3,4,5,6,7,8,9], [1,0.3,0.4])
ex2 = Exercise("Notes for Exercise 2")
ex2.addQuestion("Question 2.1", ["1", "2", "3"], [0.0, 1.0])
ex3 = Exercise("Notes for Exercise 3")
ex4 = Exercise("Notes for Exercise 4")
ex4.addQuestion("Question 4.1", ["1"], [1.0, 0.0])
ex5 = Exercise("Notes for Exercise 5")
ex6 = Exercise("Notes for Exercise 6")
ex7 = Exercise("Notes for Exercise 7")
mainTopic.addExercise(ex0).addExercise(ex1).addExercise(ex2).addExercise(ex3)
mainTopic.addExercise(ex4).addExercise(ex5).addExercise(ex6).addExercise(ex7)
#print json.dumps(mainTopic, default=lambda o: o.__dict__,sort_keys=True, indent=4)
#ts = TopicSet().addTopic(mainTopic).saveToFile()
ts = TopicSet().addTopic(mainTopic).openFromFile()