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