1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from os import sep
24 import sys
25
26
27 from data import Relax_data_store; ds = Relax_data_store()
28 from generic_fns import pipes, results, structure
29 from relax_errors import RelaxError
30 from specific_fns.model_free import main
31 from status import Status; status = Status()
32 from test_suite.unit_tests.base_classes import UnitTestCase
33
34
35 -class Test_main(UnitTestCase):
36 """Unit tests for the class methods of specific_fns.model_free.main.Model_free_main."""
37
38
39 inst = main.Model_free_main()
40
41
43 """Setup some structures for the unit tests."""
44
45
46 ds.add(pipe_name='orig', pipe_type='mf')
47
48
50 """Test the model-free duplicate_data() method."""
51
52
53 self.inst.duplicate_data('orig', 'new', model_info=0)
54
55
57 """Test the model-free duplicate_data() method."""
58
59
60 results.read(file='final_results_trunc_1.3_v2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP')
61
62
63 self.inst.duplicate_data('orig', 'new', model_info=0)
64
65
67 """Test the model-free duplicate_data() method."""
68
69
70 results.read(file='final_results_trunc_1.3_v2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP')
71
72
73 structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='internal')
74
75
76 self.inst.duplicate_data('orig', 'new', model_info=0)
77
78
79 self.assert_(hasattr(pipes.get_pipe('orig'), 'structure'))
80
81
82 self.assert_(hasattr(pipes.get_pipe('new'), 'structure'))
83
84
86 """Test the model-free duplicate_data() method."""
87
88
89 results.read(file='final_results_trunc_1.3_v2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP')
90
91
92 structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='internal')
93
94
95 self.inst.duplicate_data('orig', 'new', model_info=0)
96 self.inst.duplicate_data('orig', 'new', model_info=1)
97 self.inst.duplicate_data('orig', 'new', model_info=2)
98 self.inst.duplicate_data('orig', 'new', model_info=3)
99
100
102 """Test the failure of the model-free duplicate_data() method when the structures are not consistent."""
103
104
105 results.read(file='final_results_trunc_1.3_v1', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP')
106
107
108 structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='internal')
109
110
111 ds.add(pipe_name='new', pipe_type='mf')
112
113
114 structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='internal')
115
116
117 dp = pipes.get_pipe('new')
118 dp.structure.structural_data[0].mol[0].file_name = 'test'
119
120
121 self.assertRaises(RelaxError, self.inst.duplicate_data, 'orig', 'new', model_info=0)
122