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 os import sep
25 import sys
26
27
28 from data import Relax_data_store; ds = Relax_data_store()
29 from generic_fns import pipes, results, structure
30 from relax_errors import RelaxError
31 from specific_fns.model_free import main
32 from status import Status; status = Status()
33 from test_suite.unit_tests.base_classes import UnitTestCase
34
35
36 -class Test_main(UnitTestCase):
37 """Unit tests for the class methods of specific_fns.model_free.main.Model_free_main."""
38
39
40 inst = main.Model_free_main()
41
42
44 """Setup some structures for the unit tests."""
45
46
47 ds.add(pipe_name='orig', pipe_type='mf')
48
49
51 """Test the model-free duplicate_data() method."""
52
53
54 self.inst.duplicate_data('orig', 'new', model_info=0)
55
56
58 """Test the model-free duplicate_data() method."""
59
60
61 results.read(file='final_results_trunc_1.3_v2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP')
62
63
64 self.inst.duplicate_data('orig', 'new', model_info=0)
65
66
68 """Test the model-free duplicate_data() method."""
69
70
71 results.read(file='final_results_trunc_1.3_v2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP')
72
73
74 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')
75
76
77 self.inst.duplicate_data('orig', 'new', model_info=0)
78
79
80 self.assert_(hasattr(pipes.get_pipe('orig'), 'structure'))
81
82
83 self.assert_(hasattr(pipes.get_pipe('new'), 'structure'))
84
85
87 """Test the model-free duplicate_data() method."""
88
89
90 results.read(file='final_results_trunc_1.3_v2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP')
91
92
93 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')
94
95
96 self.inst.duplicate_data('orig', 'new', model_info=0)
97 self.inst.duplicate_data('orig', 'new', model_info=1)
98 self.inst.duplicate_data('orig', 'new', model_info=2)
99 self.inst.duplicate_data('orig', 'new', model_info=3)
100
101
103 """Test the failure of the model-free duplicate_data() method when the structures are not consistent."""
104
105
106 results.read(file='final_results_trunc_1.3_v1', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP')
107
108
109 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')
110
111
112 ds.add(pipe_name='new', pipe_type='mf')
113
114
115 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')
116
117
118 dp = pipes.get_pipe('new')
119 dp.structure.structural_data[0].mol[0].file_name = 'test'
120
121
122 self.assertRaises(RelaxError, self.inst.duplicate_data, 'orig', 'new', model_info=0)
123