Author: bugman Date: Tue Nov 27 13:17:53 2007 New Revision: 4074 URL: http://svn.gna.org/viewcvs/relax?rev=4074&view=rev Log: Added 5 unit tests for the generic_fns.selection.generate_spin_id() function. Modified: 1.3/test_suite/unit_tests/_generic_fns/test_selection.py Modified: 1.3/test_suite/unit_tests/_generic_fns/test_selection.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_generic_fns/test_selection.py?rev=4074&r1=4073&r2=4074&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_generic_fns/test_selection.py (original) +++ 1.3/test_suite/unit_tests/_generic_fns/test_selection.py Tue Nov 27 13:17:53 2007 @@ -248,6 +248,86 @@ self.assertRaises(RelaxNoPipeError, selection.exists_mol_res_spin_data) + def test_generate_spin_id1(self): + """First test of the spin ID generation function. + + The function tested is generic_fns.selection.generate_spin_id(). + """ + + # The data. + data = ['1', 'GLY'] + + # The ID. + id = selection.generate_spin_id(data) + + # Test the string. + self.assertEqual(id, ':1&GLY') + + + def test_generate_spin_id2(self): + """Second test of the spin ID generation function. + + The function tested is generic_fns.selection.generate_spin_id(). + """ + + # The data. + data = ['1', 'GLY', '234', 'NH'] + + # The ID. + id = selection.generate_spin_id(data, spin_num_col=2, spin_name_col=3) + + # Test the string. + self.assertEqual(id, ':1&GLY@234&NH') + + + def test_generate_spin_id3(self): + """Third test of the spin ID generation function. + + The function tested is generic_fns.selection.generate_spin_id(). + """ + + # The data. + data = ['Ap4Aase', '234', 'NH'] + + # The ID. + id = selection.generate_spin_id(data, mol_name_col=0, res_num_col=None, res_name_col=None, spin_num_col=1, spin_name_col=2) + + # Test the string. + self.assertEqual(id, '#Ap4Aase@234&NH') + + + def test_generate_spin_id4(self): + """Fourth test of the spin ID generation function. + + The function tested is generic_fns.selection.generate_spin_id(). + """ + + # The data. + data = ['Ap4Aase', '1', 'GLY'] + + # The ID. + id = selection.generate_spin_id(data, mol_name_col=0, res_num_col=1, res_name_col=2) + + # Test the string. + self.assertEqual(id, '#Ap4Aase:1&GLY') + + + def test_generate_spin_id5(self): + """Fifth test of the spin ID generation function. + + The function tested is generic_fns.selection.generate_spin_id(). + """ + + # The data. + data = ['Ap4Aase', '1', 'GLY', '234', 'NH'] + + # The ID. + id = selection.generate_spin_id(data, mol_name_col=0, res_num_col=1, res_name_col=2, spin_num_col=3, spin_name_col=4) + + # Test the string. + self.assertEqual(id, '#Ap4Aase:1&GLY@234&NH') + + def test_molecule_loop(self): """Test the proper operation of the molecule loop with molecule selection.