Author: bugman Date: Wed Jul 16 18:50:15 2008 New Revision: 6940 URL: http://svn.gna.org/viewcvs/relax?rev=6940&view=rev Log: Made the spin_name arg optional in the spin.create() user function. Modified: 1.3/prompt/spin.py 1.3/test_suite/unit_tests/_prompt/test_spin.py Modified: 1.3/prompt/spin.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/spin.py?rev=6940&r1=6939&r2=6940&view=diff ============================================================================== --- 1.3/prompt/spin.py (original) +++ 1.3/prompt/spin.py Wed Jul 16 18:50:15 2008 @@ -157,8 +157,8 @@ raise RelaxIntError, ('spin number', spin_num) # Spin name. - if type(spin_name) != str: - raise RelaxStrError, ('spin name', spin_name) + if spin_name != None and type(spin_name) != str: + raise RelaxNoneStrError, ('spin name', spin_name) # The residue ID. if res_id != None and type(res_id) != str: Modified: 1.3/test_suite/unit_tests/_prompt/test_spin.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_prompt/test_spin.py?rev=6940&r1=6939&r2=6940&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_prompt/test_spin.py (original) +++ 1.3/test_suite/unit_tests/_prompt/test_spin.py Wed Jul 16 18:50:15 2008 @@ -111,29 +111,68 @@ # Loop over the data types. for data in DATA_TYPES: + # Catch the None and str arguments, and skip them. + if data[0] == 'None' or data[0] == 'str': + continue + + # The argument test. + self.assertRaises(RelaxNoneStrError, self.spin_fns.create, spin_name=data[1], spin_num=1) + + + def test_create_argfail_res_id(self): + """Test the proper failure of the spin.create() user function for the res_id argument.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the None and str arguments, and skip them. + if data[0] == 'None' or data[0] == 'str': + continue + + # The argument test. + self.assertRaises(RelaxNoneStrError, self.spin_fns.create, res_id=data[1], spin_num=1, spin_name='NH') + + + def test_delete_argfail_spin_id(self): + """Test the proper failure of the spin.delete() user function for the spin_id argument.""" + + # Loop over the data types. + for data in DATA_TYPES: # Catch the str arguments, and skip them. if data[0] == 'str': continue # The argument test. - self.assertRaises(RelaxStrError, self.spin_fns.create, spin_name=data[1], spin_num=1) - - - def test_create_argfail_res_id(self): - """Test the proper failure of the spin.create() user function for the res_id argument.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the None and str arguments, and skip them. - if data[0] == 'None' or data[0] == 'str': - continue - - # The argument test. - self.assertRaises(RelaxNoneStrError, self.spin_fns.create, res_id=data[1], spin_num=1, spin_name='NH') - - - def test_delete_argfail_spin_id(self): - """Test the proper failure of the spin.delete() user function for the spin_id argument.""" + self.assertRaises(RelaxStrError, self.spin_fns.delete, spin_id=data[1]) + + + def test_display_argfail_spin_id(self): + """Test the proper failure of the spin.display() user function for the spin_id argument.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the None and str arguments, and skip them. + if data[0] == 'None' or data[0] == 'str': + continue + + # The argument test. + self.assertRaises(RelaxNoneStrError, self.spin_fns.display, spin_id=data[1]) + + + def test_name_argfail_spin_id(self): + """Test the proper failure of the spin.name() user function for the spin_id argument.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the None and str arguments, and skip them. + if data[0] == 'None' or data[0] == 'str': + continue + + # The argument test. + self.assertRaises(RelaxNoneStrError, self.spin_fns.name, spin_id=data[1]) + + + def test_name_argfail_name(self): + """Test the proper failure of the spin.name() user function for the name argument.""" # Loop over the data types. for data in DATA_TYPES: @@ -142,45 +181,6 @@ continue # The argument test. - self.assertRaises(RelaxStrError, self.spin_fns.delete, spin_id=data[1]) - - - def test_display_argfail_spin_id(self): - """Test the proper failure of the spin.display() user function for the spin_id argument.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the None and str arguments, and skip them. - if data[0] == 'None' or data[0] == 'str': - continue - - # The argument test. - self.assertRaises(RelaxNoneStrError, self.spin_fns.display, spin_id=data[1]) - - - def test_name_argfail_spin_id(self): - """Test the proper failure of the spin.name() user function for the spin_id argument.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the None and str arguments, and skip them. - if data[0] == 'None' or data[0] == 'str': - continue - - # The argument test. - self.assertRaises(RelaxNoneStrError, self.spin_fns.name, spin_id=data[1]) - - - def test_name_argfail_name(self): - """Test the proper failure of the spin.name() user function for the name argument.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the str arguments, and skip them. - if data[0] == 'str': - continue - - # The argument test. self.assertRaises(RelaxStrError, self.spin_fns.name, name=data[1])