Author: bugman Date: Wed Apr 5 05:05:21 2006 New Revision: 2441 URL: http://svn.gna.org/viewcvs/relax?rev=2441&view=rev Log: Addition of a new test to the relax test suite.
The test creates three runs, two of which have S2 values set to 0.9 and 0.7. The difference is calculated and assigned to the third run. If the S2 value of the third run is not ~0.2, then the test fails. Added: 1.2/test_suite/generic.py Modified: 1.2/test_suite/__init__.py 1.2/test_suite/test_suite.py Modified: 1.2/test_suite/__init__.py URL: http://svn.gna.org/viewcvs/relax/1.2/test_suite/__init__.py?rev=2441&r1=2440&r2=2441&view=diff ============================================================================== --- 1.2/test_suite/__init__.py (original) +++ 1.2/test_suite/__init__.py Wed Apr 5 05:05:21 2006 @@ -21,5 +21,10 @@ ############################################################################### -__all__ = ['test', - 'run_create'] +__all__ = ['test_suite', + 'diffusion_tensor', + 'generic.py', + 'model_free', + 'relax_fit', + 'run_create', + 'sequence'] Added: 1.2/test_suite/generic.py URL: http://svn.gna.org/viewcvs/relax/1.2/test_suite/generic.py?rev=2441&view=auto ============================================================================== --- 1.2/test_suite/generic.py (added) +++ 1.2/test_suite/generic.py Wed Apr 5 05:05:21 2006 @@ -1,0 +1,78 @@ +############################################################################### +# # +# Copyright (C) 2006 Edward d'Auvergne # +# # +# This file is part of the program relax. # +# # +# relax is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# relax is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with relax; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +############################################################################### + +import sys + + +class Generic: + def __init__(self, relax, test_name): + """Class for testing various aspects specific to relaxation curve-fitting.""" + + self.relax = relax + + # Value difference test. + if test_name == 'value_diff': + # The name of the test. + self.name = "S2 difference stored in a new run." + + # The test. + self.test = self.value_diff + + + def value_diff(self, run): + """The test of storing an S2 difference in a new run.""" + + # Arguments. + self.run = run + + # Create three runs. + self.relax.interpreter._Run.create('orig1', "mf") + self.relax.interpreter._Run.create('orig2', "mf") + self.relax.interpreter._Run.create('new', "mf") + + # Load the Lupin Ap4Aase sequence. + self.relax.interpreter._Sequence.read('orig1', file="Ap4Aase.seq", dir=sys.path[-1] + "/test_suite/data") + self.relax.interpreter._Sequence.read('orig2', file="Ap4Aase.seq", dir=sys.path[-1] + "/test_suite/data") + self.relax.interpreter._Sequence.read('new', file="Ap4Aase.seq", dir=sys.path[-1] + "/test_suite/data") + + # Only select residue 8. + self.relax.interpreter._Select.res('orig1', num=8, change_all=1) + self.relax.interpreter._Select.res('orig2', num=8, change_all=1) + self.relax.interpreter._Select.res('new', num=8, change_all=1) + + # Set two order parameter values. + self.relax.interpreter._Value.set('orig1', 0.9, 'S2', res_num=8) + self.relax.interpreter._Value.set('orig2', 0.7, 'S2', res_num=8) + + # Calculate the difference and assign it to residue 8 (located in position 7). + diff = self.relax.data.res['orig1'][7].s2 - self.relax.data.res['orig2'][7].s2 + self.relax.interpreter._Value.set('new', diff, 'S2', res_num=8) + + # Test if the difference is 0.2! + if abs(self.relax.data.res['new'][7].s2 - 0.2) > 0.00001: + print "The difference of '" + `diff` + "' should be equal to 0.2." + return + + # Success. + else: + return 1 + Modified: 1.2/test_suite/test_suite.py URL: http://svn.gna.org/viewcvs/relax/1.2/test_suite/test_suite.py?rev=2441&r1=2440&r2=2441&view=diff ============================================================================== --- 1.2/test_suite/test_suite.py (original) +++ 1.2/test_suite/test_suite.py Wed Apr 5 05:05:21 2006 @@ -27,6 +27,7 @@ # Import the tests. from diffusion_tensor import Diffusion_tensor +from generic import Generic from model_free import Mf from relax_fit import Relax_fit from run_create import Run_create @@ -135,6 +136,22 @@ # Execute the tests. self.exec_tests(self.mf_test_array) + + + # Generic tests. + ################ + + # Heading. + self.heading("The generic tests") + + # Initialise the array containing each test element. + self.generic_test_array = [] + + # The tests. + self.generic_test_array.append(Generic(self.relax, 'value_diff')) + + # Execute the tests. + self.exec_tests(self.generic_test_array) # Summary. @@ -263,6 +280,17 @@ self.summary_line(test) + # Generic tests. + ################ + + # Heading. + sys.stdout.write("\nThe generic tests:\n") + + # Loop over the tests. + for test in self.generic_test_array: + self.summary_line(test) + + # Synposis. ########### _______________________________________________ relax (http://nmr-relax.com) This is the relax-commits mailing list relax-commits@gna.org To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-commits