Author: bugman Date: Fri Mar 6 11:06:21 2009 New Revision: 8911 URL: http://svn.gna.org/viewcvs/relax?rev=8911&view=rev Log: Merged revisions 8909-8910 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3 ........ r8909 | bugman | 2009-03-06 10:59:32 +0100 (Fri, 06 Mar 2009) | 3 lines Added another unit test to reveal a bug in the spin.copy() user function. ........ r8910 | bugman | 2009-03-06 11:05:09 +0100 (Fri, 06 Mar 2009) | 5 lines Bug fix for the spin.copy() user function. Non-empty spin containers are no longer overwritten if the name and num are set to None. ........ Modified: branches/bmrb/ (props changed) branches/bmrb/generic_fns/mol_res_spin.py branches/bmrb/test_suite/unit_tests/spin_testing_base.py Propchange: branches/bmrb/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri Mar 6 11:06:21 2009 @@ -1,1 +1,1 @@ -/1.3:1-8902 +/1.3:1-8910 Modified: branches/bmrb/generic_fns/mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/mol_res_spin.py?rev=8911&r1=8910&r2=8911&view=diff ============================================================================== --- branches/bmrb/generic_fns/mol_res_spin.py (original) +++ branches/bmrb/generic_fns/mol_res_spin.py Fri Mar 6 11:06:21 2009 @@ -737,7 +737,7 @@ res_to_cont = pipe.mol[0].res[0] # Copy the data. - if res_to_cont.spin[0].num == None and res_to_cont.spin[0].name == None and len(res_to_cont.spin) == 1: + if len(res_to_cont.spin) == 1 and res_to_cont.spin[0].is_empty(): res_to_cont.spin[0] = spin_from_cont.__clone__() else: res_to_cont.spin.append(spin_from_cont.__clone__()) Modified: branches/bmrb/test_suite/unit_tests/spin_testing_base.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/test_suite/unit_tests/spin_testing_base.py?rev=8911&r1=8910&r2=8911&view=diff ============================================================================== --- branches/bmrb/test_suite/unit_tests/spin_testing_base.py (original) +++ branches/bmrb/test_suite/unit_tests/spin_testing_base.py Fri Mar 6 11:06:21 2009 @@ -101,11 +101,45 @@ cdp.mol[1].res[1].spin.add_item(None, 1433) cdp.mol[1].res[1].spin.add_item('NH', 3239) + # Create a third molecule. + cdp.mol.add_item('3rd') + + # Create the first residue of the 3rd molecule and add some data to its spin container. + cdp.mol[2].res[0].num = 13 + cdp.mol[2].res[0].name = 'Gly' + cdp.mol[2].res[0].spin[0].x = 'hello' + def tearDown(self): """Reset the relax data storage object.""" ds.__reset__() + + + def test_copy_spin(self): + """Test the copying of the spin data within the same residue. + + The function tested is both generic_fns.mol_res_spin.copy_spin() and + prompt.spin.copy(). + """ + + # Copy the spin from the 3rd molecule. + self.spin_fns.copy(spin_from='#3rd:13', spin_to='#3rd:13@NE') + + # Get the data pipe. + dp = pipes.get_pipe('orig') + + # Test the original spin. + self.assertEqual(dp.mol[2].res[0].num, 13) + self.assertEqual(dp.mol[2].res[0].name, 'Gly') + self.assertEqual(dp.mol[2].res[0].spin[0].num, None) + self.assertEqual(dp.mol[2].res[0].spin[0].name, None) + self.assertEqual(dp.mol[2].res[0].spin[0].x, 'hello') + + # Test the new spin. + self.assertEqual(dp.mol[2].res[0].spin[1].num, None) + self.assertEqual(dp.mol[2].res[0].spin[1].name, 'NE') + self.assertEqual(dp.mol[2].res[0].spin[1].x, 'hello') def test_copy_spin_between_molecules(self):