mailr6248 - /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:12:35 2008
New Revision: 6248

URL: http://svn.gna.org/viewcvs/relax?rev=6248&view=rev
Log:
Wrote a unit test for the resetting of an unpickled and restored relax data 
storage singleton.


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=6248&r1=6247&r2=6248&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:12:35 2008
@@ -75,7 +75,7 @@
         # 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).
+        # Test the contents of the restored singleton.
         self.assertEqual(relax_data_store.keys(), ['orig'])
         self.assertEqual(relax_data_store.current_pipe, 'orig')
         self.assertEqual(relax_data_store['orig'].x, 1)
@@ -114,6 +114,34 @@
         self.assertEqual(relax_data_store['new'].z, [None, None])
 
 
+    def test_load_and_reset(self):
+        """The resetting 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')
+
+        # Reset.
+        relax_data_store.__reset__()
+
+        # Test that there are no contents in the reset singleton.
+        self.assertEqual(relax_data_store.keys(), [])
+        self.assertEqual(relax_data_store.current_pipe, None)
+        self.assert_(not hasattr(relax_data_store, 'y'))
+
+
     def test_save(self):
         """The pickling and saving of the relax data storage singleton.
 




Related Messages


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