Author: bugman Date: Tue Nov 20 23:36:39 2007 New Revision: 3734 URL: http://svn.gna.org/viewcvs/relax?rev=3734&view=rev Log: The generic_fns.state module unit test code is now using the base class. Modified: 1.3/test_suite/unit_tests/generic_fns/test_state.py Modified: 1.3/test_suite/unit_tests/generic_fns/test_state.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/generic_fns/test_state.py?rev=3734&r1=3733&r2=3734&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/generic_fns/test_state.py (original) +++ 1.3/test_suite/unit_tests/generic_fns/test_state.py Tue Nov 20 23:36:39 2007 @@ -21,78 +21,15 @@ ############################################################################### # Python module imports. -from os import remove from unittest import TestCase # relax module imports. from data import Data as relax_data_store from generic_fns.state import load_state, save_state +from test_suite.unit_tests.state_testing_base import State_base_class -class Test_state(TestCase): +class Test_state(State_base_class, TestCase): """Unit tests for the functions of the 'generic_fns.state' module.""" - def setUp(self): - """Set up for all the data pipe unit tests.""" - - # Reset the relax data storage object. - relax_data_store.__reset__() - - # Add a data pipe to the data store. - relax_data_store.add(pipe_name='orig', pipe_type='mf') - - # Add a single object to the 'orig' data pipe. - relax_data_store['orig'].x = 1 - - # Add a single object to the storage object. - relax_data_store.y = 'Hello' - - - def tearDown(self): - """Reset the relax data storage object.""" - - # Reset the relax data store. - relax_data_store.__reset__() - - # Clean up the temporarily created dump files. - try: - remove('test.bz2') - except OSError: - pass - - - def test_load(self): - """The unpickling and restoration of the relax data storage singleton. - - This tests the normal operation of the generic_fns.state.load() function. - """ - - # Save the state. - save_state('test') - - # Reset the relax data store. - relax_data_store.__reset__() - - # 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')) - - # Load the state. - load_state('test') - - # 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) - - - def test_save(self): - """The pickling and saving of the relax data storage singleton. - - This tests the normal operation of the generic_fns.state.save() function. - """ - - # Save the state. - save_state('test')