Package test_suite :: Package unit_tests :: Package _specific_fns :: Package _model_free :: Module test_main
[hide private]
[frames] | no frames]

Source Code for Module test_suite.unit_tests._specific_fns._model_free.test_main

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2008-2011 Edward d'Auvergne                                   # 
  4  #                                                                             # 
  5  # This file is part of the program relax.                                     # 
  6  #                                                                             # 
  7  # relax is free software; you can redistribute it and/or modify               # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation; either version 2 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # relax is distributed in the hope that it will be useful,                    # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with relax; if not, write to the Free Software                        # 
 19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23  # Python module imports. 
 24  from os import sep 
 25  import sys 
 26   
 27  # relax module imports. 
 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 # Instantiate the class. 40 inst = main.Model_free_main() 41 42
43 - def setUp(self):
44 """Setup some structures for the unit tests.""" 45 46 # Create a model-free data pipe. 47 ds.add(pipe_name='orig', pipe_type='mf')
48 49
50 - def test_duplicate_data1(self):
51 """Test the model-free duplicate_data() method.""" 52 53 # Duplicate the data. 54 self.inst.duplicate_data('orig', 'new', model_info=0)
55 56
57 - def test_duplicate_data2(self):
58 """Test the model-free duplicate_data() method.""" 59 60 # Read a model-free results file. 61 results.read(file='final_results_trunc_1.3', directory=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') 62 63 # Duplicate the data. 64 self.inst.duplicate_data('orig', 'new', model_info=0)
65 66
67 - def test_duplicate_data3(self):
68 """Test the model-free duplicate_data() method.""" 69 70 # Read a model-free results file. 71 results.read(file='final_results_trunc_1.3', directory=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') 72 73 # Load a structure. 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 # Duplicate the data. 77 self.inst.duplicate_data('orig', 'new', model_info=0) 78 79 # Check the original data. 80 self.assert_(hasattr(pipes.get_pipe('orig'), 'structure')) 81 82 # Check the duplication. 83 self.assert_(hasattr(pipes.get_pipe('new'), 'structure'))
84 85
87 """Test the model-free duplicate_data() method.""" 88 89 # Read a model-free results file. 90 results.read(file='final_results_trunc_1.3', directory=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') 91 92 # Load a structure. 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 # Duplicate the data, model by model. 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 # Read a model-free results file. 106 results.read(file='final_results_trunc_1.3', directory=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') 107 108 # Load a structure. 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 # Create a new model-free data pipe. 112 ds.add(pipe_name='new', pipe_type='mf') 113 114 # Load the structure for the second pipe. 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 # Modify the structure. 118 dp = pipes.get_pipe('new') 119 dp.structure.structural_data[0].mol[0].file_name = 'test' 120 121 # Duplicate the data and catch the error. 122 self.assertRaises(RelaxError, self.inst.duplicate_data, 'orig', 'new', model_info=0)
123