mailr8670 - in /branches/relax_disp: prompt/relax_disp.py test_suite/unit_tests/_prompt/test_relax_disp.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by sebastien . morin . 1 on January 27, 2009 - 16:09:
Author: semor
Date: Tue Jan 27 16:09:31 2009
New Revision: 8670

URL: http://svn.gna.org/viewcvs/relax?rev=8670&view=rev
Log:
Added two unit tests for the relaxation dispersion code and fixed errors in 
the corresponding code.

More unit tests will be added soon to help debugging and developing.


Modified:
    branches/relax_disp/prompt/relax_disp.py
    branches/relax_disp/test_suite/unit_tests/_prompt/test_relax_disp.py

Modified: branches/relax_disp/prompt/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/prompt/relax_disp.py?rev=8670&r1=8669&r2=8670&view=diff
==============================================================================
--- branches/relax_disp/prompt/relax_disp.py (original)
+++ branches/relax_disp/prompt/relax_disp.py Tue Jan 27 16:09:31 2009
@@ -30,7 +30,7 @@
 
 # relax module imports.
 import help
-from relax_errors import RelaxNoneNumError, RelaxNumError, RelaxStrError
+from relax_errors import RelaxNoneNumError, RelaxStrError
 from specific_fns.setup import relax_disp_obj
 
 
@@ -118,13 +118,13 @@
             text = text + ", delayT=" + `delayT` + ")"
             print text
 
+        # The CPMG constant time delay (T).
+        if type(delayT) != float and type(delayT) != int and delayT != None:
+            raise RelaxNoneNumError, ('CPMG constant time delay (T)', delayT)
+
         # Id string.
         if type(id) != str:
             raise RelaxStrError, ('experiment identification string', id)
-
-        # The CPMG constant time delay (T).
-        if type(delayT) != float and type(delayT) != int:
-            raise RelaxNumError, ('CPMG constant time delay (T)', delayT)
 
         # Execute the functional code.
         relax_disp_obj.cpmg_delayT(id=id, delayT=delayT)

Modified: branches/relax_disp/test_suite/unit_tests/_prompt/test_relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/unit_tests/_prompt/test_relax_disp.py?rev=8670&r1=8669&r2=8670&view=diff
==============================================================================
--- branches/relax_disp/test_suite/unit_tests/_prompt/test_relax_disp.py 
(original)
+++ branches/relax_disp/test_suite/unit_tests/_prompt/test_relax_disp.py Tue 
Jan 27 16:09:31 2009
@@ -24,36 +24,23 @@
 from unittest import TestCase
 
 # relax module imports.
-from prompt.relax_fit import Relax_fit
-from relax_errors import RelaxNumError, RelaxStrError
+from prompt.relax_disp import Relax_disp
+from relax_errors import RelaxNoneNumError, RelaxStrError
 
 # Unit test imports.
 from data_types import DATA_TYPES
 import fake_relax
 
 
-class Test_relax_fit(TestCase):
-    """Unit tests for the functions of the 'prompt.relax_fit' module."""
+class Test_relax_disp(TestCase):
+    """Unit tests for the functions of the 'prompt.relax_disp' module."""
 
     # Instantiate the user function class.
-    relax_fit_fns = Relax_fit(fake_relax.fake_instance())
+    relax_disp_fns = Relax_disp(fake_relax.fake_instance())
 
 
-    def test_relax_time_argfail_time(self):
-        """The time arg test of the relax_fit.relax_time() user function."""
-
-        # Loop over the data types.
-        for data in DATA_TYPES:
-            # Catch the float, bin, and int arguments, and skip them.
-            if data[0] == 'float' or data[0] == 'bin' or data[0] == 'int':
-                continue
-
-            # The argument test.
-            self.assertRaises(RelaxNumError, self.relax_fit_fns.relax_time, 
time=data[1])
-
-
-    def test_relax_time_argfail_spectrum_id(self):
-        """The spectrum_id arg test of the relax_fit.relax_time() user 
function."""
+    def test_relax_cpmg_delayT_argfail_id(self):
+        """The id arg test of the relax_disp.relax_cpmg_delayT() user 
function."""
 
         # Loop over the data types.
         for data in DATA_TYPES:
@@ -62,17 +49,17 @@
                 continue
 
             # The argument test.
-            self.assertRaises(RelaxStrError, self.relax_fit_fns.relax_time, 
spectrum_id=data[1])
+            self.assertRaises(RelaxStrError, 
self.relax_disp_fns.cpmg_delayT, id=data[1])
 
 
-    def test_select_model_argfail_model(self):
-        """The model arg test of the relax_fit.select_model() user 
function."""
+    def test_relax_cpmg_delayT_argfail_delayT(self):
+        """The delayT arg test of the relax_disp.cpmg_delayT() user 
function."""
 
         # Loop over the data types.
         for data in DATA_TYPES:
-            # Catch the str arguments, and skip them.
-            if data[0] == 'str':
+            # Catch the float, int and None arguments, and skip them.
+            if data[0] == 'float' or data[0] == 'int' or data[0] == 'None':
                 continue
 
-            # The argument test.
-            self.assertRaises(RelaxStrError, 
self.relax_fit_fns.select_model, model=data[1])
+        # The argument test.
+        self.assertRaises(RelaxNoneNumError, 
self.relax_disp_fns.cpmg_delayT, delayT=data[1])




Related Messages


Powered by MHonArc, Updated Tue Jan 27 16:20:02 2009