Author: bugman Date: Wed Feb 19 14:09:31 2014 New Revision: 22208 URL: http://svn.gna.org/viewcvs/relax?rev=22208&view=rev Log: Added the infrastructure for the unit tests of the specific_analyses.relax_disp.disp_data module. This is in response to the post http://thread.gmane.org/gmane.science.nmr.relax.scm/19963/focus=5046 by Troels, and is described in my response at http://thread.gmane.org/gmane.science.nmr.relax.scm/19963/focus=5048. Added: trunk/test_suite/unit_tests/_specific_analyses/_relax_disp/test_disp_data.py - copied, changed from r22205, trunk/test_suite/unit_tests/_specific_analyses/_model_free/test_main.py Copied: trunk/test_suite/unit_tests/_specific_analyses/_relax_disp/test_disp_data.py (from r22205, trunk/test_suite/unit_tests/_specific_analyses/_model_free/test_main.py) URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_specific_analyses/_relax_disp/test_disp_data.py?p2=trunk/test_suite/unit_tests/_specific_analyses/_relax_disp/test_disp_data.py&p1=trunk/test_suite/unit_tests/_specific_analyses/_model_free/test_main.py&r1=22205&r2=22208&rev=22208&view=diff ============================================================================== --- trunk/test_suite/unit_tests/_specific_analyses/_model_free/test_main.py (original) +++ trunk/test_suite/unit_tests/_specific_analyses/_relax_disp/test_disp_data.py Wed Feb 19 14:09:31 2014 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2008-2013 Edward d'Auvergne # +# Copyright (C) 2008-2014 Edward d'Auvergne # # # # This file is part of the program relax (http://www.nmr-relax.com). # # # @@ -24,97 +24,17 @@ # relax module imports. from data_store import Relax_data_store; ds = Relax_data_store() -from pipe_control import pipes, results, structure -from lib.errors import RelaxError -from specific_analyses.model_free import main +from pipe_control import state +from specific_analyses.relax_disp.disp_data import loop_exp_frq_offset_point_time from status import Status; status = Status() from test_suite.unit_tests.base_classes import UnitTestCase -class Test_main(UnitTestCase): - """Unit tests for the class methods of specific_analyses.model_free.main.Model_free_main.""" - - # Instantiate the class. - inst = main.Model_free_main() - +class Test_disp_data(UnitTestCase): + """Unit tests for the functions of the specific_analyses.relax_disp.disp_data module.""" def setUp(self): """Setup some structures for the unit tests.""" - # Create a model-free data pipe. - ds.add(pipe_name='orig', pipe_type='mf') - - - def test_duplicate_data1(self): - """Test the model-free duplicate_data() method.""" - - # Duplicate the data. - self.inst.duplicate_data('orig', 'new', model_info=0) - - - def test_duplicate_data2(self): - """Test the model-free duplicate_data() method.""" - - # Read a model-free results file. - results.read(file='final_results_trunc_1.3_v2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') - - # Duplicate the data. - self.inst.duplicate_data('orig', 'new', model_info=0) - - - def test_duplicate_data3(self): - """Test the model-free duplicate_data() method.""" - - # Read a model-free results file. - results.read(file='final_results_trunc_1.3_v2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') - - # Load a structure. - structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1) - - # Duplicate the data. - self.inst.duplicate_data('orig', 'new', model_info=0) - - # Check the original data. - self.assert_(hasattr(pipes.get_pipe('orig'), 'structure')) - - # Check the duplication. - self.assert_(hasattr(pipes.get_pipe('new'), 'structure')) - - - def test_duplicate_data_single_mf_model(self): - """Test the model-free duplicate_data() method.""" - - # Read a model-free results file. - results.read(file='final_results_trunc_1.3_v2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') - - # Load a structure. - structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1) - - # Duplicate the data, model by model. - self.inst.duplicate_data('orig', 'new', model_info=0) - self.inst.duplicate_data('orig', 'new', model_info=1) - self.inst.duplicate_data('orig', 'new', model_info=2) - self.inst.duplicate_data('orig', 'new', model_info=3) - - - def test_duplicate_data_fail1(self): - """Test the failure of the model-free duplicate_data() method when the structures are not consistent.""" - - # Read a model-free results file. - results.read(file='final_results_trunc_1.3_v1', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') - - # Load a structure. - structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1) - - # Create a new model-free data pipe. - ds.add(pipe_name='new', pipe_type='mf') - - # Load the structure for the second pipe. - structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1) - - # Modify the structure. - dp = pipes.get_pipe('new') - dp.structure.structural_data[0].mol[0].file_name = 'test' - - # Duplicate the data and catch the error. - self.assertRaises(RelaxError, self.inst.duplicate_data, 'orig', 'new', model_info=0) + # Create a dispersion data pipe. + ds.add(pipe_name='orig', pipe_type='relax_disp')