-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_interface.py
76 lines (63 loc) · 2.41 KB
/
test_interface.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
75
76
import unittest
import pandas as pd
from interface import Interface, NSizeError
class InterfaceTest(unittest.TestCase):
def setUp(self):
self._n = {
'y1': [5, 21, 36],
'y2': [5, 22, 36],
'y4': [3, 9, 27]
}
def test_training_subplots(self):
self.assertTrue(Interface(plot_training_subplots=True,
continue_matching=False))
def test_without_plot(self):
df = Interface(plot=False,
map_train=False,
_n=self._n,
to_db=False,
create_tables=False)
self.assertEqual(type(pd.DataFrame()), type(df.result),
'should return pandas df')
def test_with_plot(self):
df = Interface(map_train=True,
_n=self._n,
to_db=False,
create_tables=False)
self.assertEqual(type(tuple()), type(df.result),
'should return pandas df')
self.assertEqual(type(dict()), type(df.result[1]))
def test_n_size(self):
n = {
'y1': [5, 21, 36],
'y2': [5, 22, 36],
'y4': [3, 9, 27, 4]
}
with self.assertRaises(NSizeError):
df = Interface(map_train=False,
_n=n,
to_db=False,
create_tables=False)
df = Interface(map_train=False,
_n=self._n,
to_db=False,
create_tables=False)
self.assertEqual(type(pd.DataFrame()), type(df.result),
'should return pandas df')
def test_compare_models(self):
df = Interface(map_train=True,
_n=self._n,
to_db=False,
create_tables=False)
df2 = Interface(continue_matching=False,
compare_models={'m1': df.models_master_1,
'm2': df.models_master_2,
'm3': df.models_master_3})
def test_run_complete(self):
df = Interface(map_train=True,
_n=self._n,
to_db=False,
create_tables=False,
run_complete=True)
if __name__ == '__main__':
unittest.main()