mailr4364 - in /1.3/test_suite/system_tests: __init__.py generic.py main.py


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

Header


Content

Posted by edward on January 05, 2008 - 20:58:
Author: bugman
Date: Sat Jan  5 20:32:06 2008
New Revision: 4364

URL: http://svn.gna.org/viewcvs/relax?rev=4364&view=rev
Log:
Converted all of the generic system/functional tests to the new unittest 
framework.


Modified:
    1.3/test_suite/system_tests/__init__.py
    1.3/test_suite/system_tests/generic.py
    1.3/test_suite/system_tests/main.py

Modified: 1.3/test_suite/system_tests/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/__init__.py?rev=4364&r1=4363&r2=4364&view=diff
==============================================================================
--- 1.3/test_suite/system_tests/__init__.py (original)
+++ 1.3/test_suite/system_tests/__init__.py Sat Jan  5 20:32:06 2008
@@ -29,6 +29,7 @@
 # relax system/functional test module imports.
 from angles import Angles
 from diffusion_tensor import Diffusion_tensor
+from generic import Generic
 from model_free import Mf
 from test_pipe_create import Test_pipe_create
 
@@ -66,6 +67,7 @@
         suite_array = []
         suite_array.append(TestLoader().loadTestsFromTestCase(Angles))
         
suite_array.append(TestLoader().loadTestsFromTestCase(Diffusion_tensor))
+        suite_array.append(TestLoader().loadTestsFromTestCase(Generic))
         suite_array.append(TestLoader().loadTestsFromTestCase(Mf))
         
suite_array.append(TestLoader().loadTestsFromTestCase(Test_pipe_create))
 

Modified: 1.3/test_suite/system_tests/generic.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/generic.py?rev=4364&r1=4363&r2=4364&view=diff
==============================================================================
--- 1.3/test_suite/system_tests/generic.py (original)
+++ 1.3/test_suite/system_tests/generic.py Sat Jan  5 20:32:06 2008
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2006-2007 Edward d'Auvergne                                  
 #
+# Copyright (C) 2006-2008 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -21,36 +21,25 @@
 
###############################################################################
 
 # Python module imports.
+from unittest import TestCase
 import sys
 
 # relax module imports.
 from data import Data as relax_data_store
 
 
-# The relax data storage object.
+
+class Generic(TestCase):
+    """Class for testing various aspects specific to relaxation 
curve-fitting."""
+
+    def tearDown(self):
+        """Reset the relax data storage object."""
+
+        relax_data_store.__reset__()
 
 
-
-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 data pipe."
-
-            # The test.
-            self.test = self.value_diff
-
-
-    def value_diff(self, pipe):
-        """The test of storing an S2 difference in a new data pipe."""
-
-        # Arguments.
-        self.pipe = pipe
+    def test_value_diff(self):
+        """S2 difference stored in a new data pipe."""
 
         # Init.
         pipes = ['orig1', 'orig2', 'new']
@@ -76,11 +65,4 @@
         self.relax.interpreter._Value.set(diff, 'S2', res_num=8)
 
         # Test if the difference is 0.2!
-        if abs(relax_data_store['new'].mol[0].res[7].spin[0].s2 - 0.2) > 
0.00001:
-            print "The difference of '" + `diff` + "' should be equal to 
0.2."
-            return
-
-        # Success.
-        else:
-            return 1
-
+        
self.assertAlmostEqual(relax_data_store['new'].mol[0].res[7].spin[0].s2, 0.2)

Modified: 1.3/test_suite/system_tests/main.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/main.py?rev=4364&r1=4363&r2=4364&view=diff
==============================================================================
--- 1.3/test_suite/system_tests/main.py (original)
+++ 1.3/test_suite/system_tests/main.py Sat Jan  5 20:32:06 2008
@@ -28,7 +28,6 @@
 from test_suite.formatting import *
 
 # Import the tests.
-from generic import Generic
 from jw_mapping import Jw
 from model_selection import Modsel
 from relax_fit import Relax_fit
@@ -124,22 +123,6 @@
 
         # Execute the tests.
         self.exec_tests(self.modsel_test_array)
-
-
-        # Generic tests.
-        ################
-
-        # Heading.
-        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)
 
 
         # Fin.
@@ -257,21 +240,6 @@
             summary_line(test.name, test.passed)
 
 
-        # Generic tests.
-        ################
-
-        # Heading.
-        sys.stdout.write("\nThe generic tests:\n")
-
-        # Loop over the tests.
-        for test in self.generic_test_array:
-            # Synopsis.
-            global_pass = global_pass and test.passed
-
-            # Print the summary line.
-            summary_line(test.name, test.passed)
-
-
         # Synposis.
         ###########
 




Related Messages


Powered by MHonArc, Updated Sat Jan 05 21:00:32 2008