1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 from unittest import TestCase
25
26
27 from data.mol_res_spin import MoleculeList
28
29
31 """Unit tests for the data.mol_res_spin relax module."""
32
34 """Create a mol-res-spin structure for testing all the object methods."""
35
36
37 self.mol = MoleculeList()
38
39
40 self.mol[0].res[0].spin[0].x = 1
41
42
44 """Unit test for the 'add_item()' method of the MolecularList class."""
45
46
47 name = 'Ap4Aase'
48
49
50 self.mol.add_item(mol_name=name)
51
52
53 self.assertEqual(self.mol[1].name, name)
54
55
56 self.assert_(not hasattr(self.mol[1].res[0].spin[0], 'x'))
57
58
60 """Unit test for the 'add_item()' method of the ResidueList class."""
61
62
63 name = 'LEU'
64 num = -5
65
66
67 self.mol[0].res.add_item(res_name=name, res_num=num)
68
69
70 self.assertEqual(self.mol[0].res[1].name, name)
71 self.assertEqual(self.mol[0].res[1].num, num)
72
73
74 self.assert_(not hasattr(self.mol[0].res[1].spin[0], 'x'))
75
76
78 """Unit test for the 'add_item()' method of the SpinList class."""
79
80
81 name = 'N'
82 num = 1409
83
84
85 self.mol[0].res[0].spin.add_item(spin_name=name, spin_num=num, select=0)
86
87
88 self.assertEqual(self.mol[0].res[0].spin[1].name, name)
89 self.assertEqual(self.mol[0].res[0].spin[1].num, num)
90 self.assertEqual(self.mol[0].res[0].spin[1].select, 0)
91
92
93 self.assert_(not hasattr(self.mol[0].res[0].spin[1], 'x'))
94
95
97 """Unit test for the validity of the MoleculeContainer.__repr__() method."""
98
99
100 self.assert_(type(self.mol[0].__repr__()), str)
101
102
104 """Unit test for the validity of the MoleculeList.__repr__() method."""
105
106
107 self.assert_(type(self.mol.__repr__()), str)
108
109
111 """Unit test for the validity of the ResidueContainer.__repr__() method."""
112
113
114 self.assert_(type(self.mol[0].res[0].__repr__()), str)
115
116
118 """Unit test for the validity of the ResidueList.__repr__() method."""
119
120
121 self.assert_(type(self.mol[0].res.__repr__()), str)
122
123
125 """Unit test for the validity of the SpinContainer.__repr__() method."""
126
127
128 self.assert_(type(self.mol[0].res[0].spin[0].__repr__()), str)
129
130
132 """Unit test for the validity of the SpinList.__repr__() method."""
133
134
135 self.assert_(type(self.mol[0].res[0].spin.__repr__()), str)
136