Author: bugman
Date: Sun Nov 25 15:21:19 2007
New Revision: 3904

URL: http://svn.gna.org/viewcvs/relax?rev=3904&view=rev
Log:
A file to be imported by all the prompt user test modules for faking the relax 
instance structure.


Added:
    1.3/test_suite/unit_tests/_prompt/fake_relax.py
      - copied, changed from r3899, 
1.3/test_suite/unit_tests/_prompt/test_molecule.py

Copied: 1.3/test_suite/unit_tests/_prompt/fake_relax.py (from r3899, 
1.3/test_suite/unit_tests/_prompt/test_molecule.py)
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_prompt/fake_relax.py?p2=1.3/test_suite/unit_tests/_prompt/fake_relax.py&p1=1.3/test_suite/unit_tests/_prompt/test_molecule.py&r1=3899&r2=3904&rev=3904&view=diff
==============================================================================
--- 1.3/test_suite/unit_tests/_prompt/test_molecule.py (original)
+++ 1.3/test_suite/unit_tests/_prompt/fake_relax.py Sun Nov 25 15:21:19 2007
@@ -21,16 +21,8 @@
 ###############################################################################
 
 # Python module imports.
-from unittest import TestCase
 import sys
 
-# relax module imports.
-from data import Data as relax_data_store
-from data_types import DATA_TYPES
-from generic_fns import residue
-from prompt.molecule import Molecule
-from relax_errors import RelaxError, RelaxIntError, RelaxNoPipeError, 
RelaxNoneStrError, RelaxStrError
-from test_suite.unit_tests.molecule_testing_base import Molecule_base_class
 
 # Set the variable sys.ps3 (this is required by the user functions).
 sys.ps3 = 'relax> '
@@ -40,135 +32,18 @@
 class Container:
     pass
 
+
 # Fake normal relax usage of the user function class.
-relax = Container()
-relax.interpreter = Container()
-relax.interpreter.intro = True
+def fake_relax_instance():
+    """Function which returns a similar to the relax instance.
 
+    This structure is similar enough to the relax instance for the user 
functions to execute.
+    """
 
-class Test_molecule(Molecule_base_class, TestCase):
-    """Unit tests for the functions of the 'prompt.molecule' module."""
+    # Set up the structure.
+    relax = Container()
+    relax.interpreter = Container()
+    relax.interpreter.intro = True
 
-    # Instantiate the user function class.
-    molecule_fns = Molecule(relax)
-    residue_fns = residue
-
-
-    def test_copy_argfail_pipe_from(self):
-        """Test the proper failure of the molecule.copy() user function for 
the pipe_from 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.molecule_fns.copy, 
pipe_from=data[1], mol_from='#Old mol', mol_to='#Old mol')
-
-
-    def test_copy_argfail_mol_from(self):
-        """Test the proper failure of the molecule.copy() user function for 
the mol_from argument."""
-
-        # Loop over the data types.
-        for data in DATA_TYPES:
-            # Catch the str argument, and skip it.
-            if data[0] == 'str':
-                continue
-
-            # The argument test.
-            self.assertRaises(RelaxStrError, self.molecule_fns.copy, 
mol_from=data[1], mol_to='#Old mol')
-
-
-    def test_copy_argfail_pipe_to(self):
-        """Test the proper failure of the molecule.copy() user function for 
the pipe_to 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.molecule_fns.copy, 
pipe_to=data[1], mol_from='#Old mol', mol_to='#New mol2')
-
-
-    def test_copy_argfail_mol_to(self):
-        """Test the proper failure of the molecule.copy() user function for 
the mol_to argument."""
-
-        # Set up some data.
-        self.setup_data()
-
-        # 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.molecule_fns.copy, 
mol_from='#Old mol', mol_to=data[1])
-
-
-    def test_create_argfail_mol_name(self):
-        """Test the proper failure of the molecule.create() user function for 
the mol_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.molecule_fns.create, 
mol_name=data[1])
-
-
-    def test_delete_argfail_mol_id(self):
-        """Test the proper failure of the molecule.delete() user function for 
the mol_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.molecule_fns.delete, 
mol_id=data[1])
-
-
-    def test_display_argfail_mol_id(self):
-        """Test the proper failure of the molecule.display() user function for 
the mol_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.molecule_fns.display, 
mol_id=data[1])
-
-
-    def test_rename_argfail_mol_id(self):
-        """Test the proper failure of the molecule.rename() user function for 
the mol_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.molecule_fns.rename, 
mol_id=data[1])
-
-
-    def test_rename_argfail_new_name(self):
-        """Test the proper failure of the molecule.rename() user function for 
the new_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.molecule_fns.rename, 
new_name=data[1])
+    # Return the class instance.
+    return relax


_______________________________________________
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

Reply via email to