Author: bugman Date: Fri Sep 26 12:20:05 2008 New Revision: 7330 URL: http://svn.gna.org/viewcvs/relax?rev=7330&view=rev Log: Wrote a unit test for catching the failure of the model-free duplicate_data() method. This happens when the structures are different. Modified: 1.3/test_suite/unit_tests/_specific_fns/_model_free/test_main.py Modified: 1.3/test_suite/unit_tests/_specific_fns/_model_free/test_main.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_specific_fns/_model_free/test_main.py?rev=7330&r1=7329&r2=7330&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_specific_fns/_model_free/test_main.py (original) +++ 1.3/test_suite/unit_tests/_specific_fns/_model_free/test_main.py Fri Sep 26 12:20:05 2008 @@ -27,6 +27,7 @@ # relax module imports. from data import Relax_data_store; ds = Relax_data_store() from generic_fns import results, structure +from relax_errors import RelaxError from specific_fns.model_free import main @@ -84,3 +85,25 @@ # Check the duplication. self.assert_(hasattr(ds['new'], 'structure')) + + + 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', directory=sys.path[-1] + '/test_suite/shared_data/model_free/OMP') + + # Load a structure. + structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=sys.path[-1] + '/test_suite/shared_data/structures', model=1, parser='internal') + + # 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=sys.path[-1] + '/test_suite/shared_data/structures', model=1, parser='internal') + + # Modify the structure. + ds['new'].structure.model = 3 + + # Duplicate the data and catch the error. + self.assertRaises(RelaxError, self.inst.duplicate_data, 'orig', 'new', model_index=0)