-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_timeline.py
More file actions
92 lines (63 loc) · 2.45 KB
/
Copy pathtest_timeline.py
File metadata and controls
92 lines (63 loc) · 2.45 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import unittest
import custom_matchers
from timeline import Timeline
class TestTimeline(unittest.TestCase):
def test_concentrations(self):
tl = Timeline('A1')
tl.absorbances = [1.691, 1.736, 2.069, 2.065]
concs_expected = [1.691 / (0.195565054 * 6220), 1.736 / (0.195565054 * 6220), 2.069 / (0.195565054 * 6220),
2.065 / (0.195565054 * 6220)]
custom_matchers.assert_arrays_almost_equal(self, concs_expected, tl.concentrations())
def test_rejected(self):
tl = Timeline('A1')
tl.r_squared = 0.8999999
self.assertTrue(tl.reject())
self.assertEqual('R²=0.8999999', tl.why_reject())
tl.r_squared = 0.9
self.assertFalse(tl.reject())
def test_rejected_k_m_grubbs_test(self):
tl = Timeline('A1')
tl.r_squared = 1.0
tl.k_m = 1E-5
tl.metabolite_k_ms = [1E-5, 1.1E-5, 1.2E-5, 1E-7]
self.assertFalse(tl.reject())
tl.k_m = 1E-7
self.assertTrue(tl.reject())
self.assertEqual('Kₘ=1e-07', tl.why_reject())
def test_rejected_k_cat_grubbs_test(self):
tl = Timeline('A1')
tl.r_squared = 1.0
tl.k_cat = 2.5
tl.metabolite_k_cats = [1.5, 2.5, 3.5, 100]
self.assertFalse(tl.reject())
tl.k_cat = 100
self.assertTrue(tl.reject())
self.assertEqual('kcat=100', tl.why_reject())
def test_k_m_output(self):
tl = Timeline('A1')
tl.r_squared = 0.8999999
tl.k_m = 1E-5
self.assertEqual('', tl.k_m_output())
tl.r_squared = 1.0
custom_matchers.assert_almost_equal(self, 1E-5, tl.k_m_output())
def test_k_cat_output(self):
tl = Timeline('A1')
tl.r_squared = 0.8999999
tl.k_cat = 1.5
self.assertEqual('', tl.k_cat_output())
tl.r_squared = 1.0
custom_matchers.assert_almost_equal(self, 1.5, tl.k_cat_output())
def test_k_cat_over_k_m(self):
tl = Timeline('A1')
tl.r_squared = 0.8999999
tl.k_cat = 1.5
tl.k_m = 1E-5
self.assertEqual('', tl.k_cat_over_k_m())
tl.r_squared = 1.0
custom_matchers.assert_almost_equal(self, 1.5E5, tl.k_cat_over_k_m())
def test_r_squared_output(self):
tl = Timeline('A1')
tl.r_squared = 0.8999999
self.assertEqual('', tl.r_squared_output())
tl.r_squared = 1.0
custom_matchers.assert_almost_equal(self, 1.0, tl.r_squared_output())