-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathunit_test_decision_tree_algorithm.py
More file actions
48 lines (37 loc) · 1.71 KB
/
Copy pathunit_test_decision_tree_algorithm.py
File metadata and controls
48 lines (37 loc) · 1.71 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
__author__ = 'jackie'
import unittest
import json
import os
from YoshiViz import report_generator,decision_tree_algorithm
file_directory = os.path.join(os.path.abspath('.'), 'YoshiViz', 'input.txt')
file = open(file_directory)
#temp(string) txt to string
temp = file.read()
data = json.loads(temp)
class test_decision_tree_algorithm(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_engagement(self):
self.assertEqual(decision_tree_algorithm.\
engagement(True,9.794,14.22,0.200,1.220),True,'Test of engagement failed')
self.assertEqual(decision_tree_algorithm.\
engagement(True,9.794,14.22,0.200,1.2),False,'Test of engagement failed')
def test_informality(self):
self.assertEqual(decision_tree_algorithm.\
informality(0.1,0.8,True),True,'test of informality failed')
self.assertEqual(decision_tree_algorithm.\
informality(0.1,0.8,False),False,'test of informality failed')
def test_situatedness(self):
self.assertEqual(decision_tree_algorithm.\
situatedness(4000,15),True,'test of situatedness failed')
self.assertEqual(decision_tree_algorithm.\
situatedness(4000,16),False,'test of situatedness failed')
def test_network_of_practice(self):
self.assertEqual(decision_tree_algorithm.\
network_of_practice(0.9),True,'Test of network_of_practice failed')
self.assertEqual(decision_tree_algorithm.\
network_of_practice(0.8),False,'Test of network_of_practice failed')
if __name__ =='__main__':
unittest.main()