mailr6247 - /1.3/test_suite/unit_tests/state_testing_base.py


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

Header


Content

Posted by edward on May 22, 2008 - 16:38:
Author: bugman
Date: Thu May 22 15:07:56 2008
New Revision: 6247

URL: http://svn.gna.org/viewcvs/relax?rev=6247&view=rev
Log:
Split the state loading unit test into 2.

One tests the loading whereas the second checks the modification of a loaded 
state.


Modified:
    1.3/test_suite/unit_tests/state_testing_base.py

Modified: 1.3/test_suite/unit_tests/state_testing_base.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/state_testing_base.py?rev=6247&r1=6246&r2=6247&view=diff
==============================================================================
--- 1.3/test_suite/unit_tests/state_testing_base.py (original)
+++ 1.3/test_suite/unit_tests/state_testing_base.py Thu May 22 15:07:56 2008
@@ -75,6 +75,32 @@
         # Load the state.
         self.state.load_state(state='basic_single_pipe', 
dir_name=path+'/test_suite/shared_data/saved_states')
 
+        # Test the contents of the restored singleton (with subsequent data 
added).
+        self.assertEqual(relax_data_store.keys(), ['orig'])
+        self.assertEqual(relax_data_store.current_pipe, 'orig')
+        self.assertEqual(relax_data_store['orig'].x, 1)
+        self.assertEqual(relax_data_store.y, 'Hello')
+
+
+    def test_load_and_modify(self):
+        """The modification of an unpickled and restored relax data storage 
singleton.
+
+        This tests the normal operation of the generic_fns.state.load() 
function.
+        """
+
+        # Test the contents of the empty singleton.
+        self.assertEqual(relax_data_store.keys(), [])
+        self.assertEqual(relax_data_store.current_pipe, None)
+        self.assert_(not hasattr(relax_data_store, 'y'))
+
+        # Get the relative path of relax.
+        path = sys.path[0]
+        if path == '.':
+            path = sys.path[-1]
+
+        # Load the state.
+        self.state.load_state(state='basic_single_pipe', 
dir_name=path+'/test_suite/shared_data/saved_states')
+
         # Add a new data pipe and some data to it.
         relax_data_store.add('new', 'jw_mapping')
         relax_data_store[relax_data_store.current_pipe].z = [None, None]




Related Messages


Powered by MHonArc, Updated Thu May 22 17:00:21 2008