Author: bugman Date: Sun Nov 4 15:42:22 2007 New Revision: 3413 URL: http://svn.gna.org/viewcvs/relax?rev=3413&view=rev Log: Added the setUp and tearDown functions for the generic_fns.molecule function unit tests. Modified: 1.3/test_suite/unit_tests/generic_fns/test_molecule.py Modified: 1.3/test_suite/unit_tests/generic_fns/test_molecule.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/generic_fns/test_molecule.py?rev=3413&r1=3412&r2=3413&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/generic_fns/test_molecule.py (original) +++ 1.3/test_suite/unit_tests/generic_fns/test_molecule.py Sun Nov 4 15:42:22 2007 @@ -30,3 +30,48 @@ class Test_spin(TestCase): """Unit tests for the functions of the 'generic_fns.molecule' module.""" + + def setUp(self): + """Set up for all the residue unit tests.""" + + # Reset the relax data storage object. + relax_data_store.__reset__() + + # Add a data pipe to the data store. + relax_data_store.add(pipe_name='orig', pipe_type='mf') + + # Add a second data pipe for copying tests. + relax_data_store.add(pipe_name='test', pipe_type='mf') + + # Set the current data pipe to 'orig'. + relax_data_store.current_pipe = 'orig' + + + def tearDown(self): + """Reset the relax data storage object.""" + + relax_data_store.__reset__() + + + def setup_data(self): + """Function for setting up some data for testing.""" + + # Create the first residue and add some data to its spin container. + residue.create(1, 'Ala') + relax_data_store['orig'].mol[0].res[0].spin[0].num = 111 + relax_data_store['orig'].mol[0].res[0].spin[0].x = 1 + relax_data_store['orig'].mol[0].name = 'Old mol' + + # Create a second molecule. + relax_data_store['orig'].mol.add_item('New mol') + + # Copy the residue to the new molecule. + residue.copy(res_from=':1', res_to='#New mol') + residue.copy(res_from='#Old mol:1', res_to='#New mol:5') + + # Change the first residue's data. + relax_data_store['orig'].mol[0].res[0].spin[0].num = 222 + relax_data_store['orig'].mol[0].res[0].spin[0].x = 2 + + +