Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2008-2012 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax. # 6 # # 7 # relax is free software; you can redistribute it and/or modify # 8 # it under the terms of the GNU General Public License as published by # 9 # the Free Software Foundation; either version 2 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # relax is distributed in the hope that it will be useful, # 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 # GNU General Public License for more details. # 16 # # 17 # You should have received a copy of the GNU General Public License # 18 # along with relax; if not, write to the Free Software # 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 20 # # 21 ############################################################################### 22 23 # Python module imports. 24 from copy import deepcopy 25 import sys 26 from tempfile import mktemp 27 28 # relax module imports. 29 from base_classes import SystemTestCase 30 from data import Relax_data_store; ds = Relax_data_store() 31 from generic_fns.pipes import VALID_TYPES, get_pipe 32 from generic_fns.reset import reset 33 3436 """Class for testing the state saving and loading user functions.""" 3711839 """Common set up for these system tests.""" 40 41 # Create a temporary file name. 42 self.tmpfile = mktemp()43 4446 """Test the saving, loading, and second saving and loading of the program state in pickled format.""" 47 48 # Create a data pipe. 49 self.interpreter.pipe.create('test', 'mf') 50 51 # Save the state. 52 self.interpreter.state.save(self.tmpfile, pickle=True, force=True) 53 54 # Load the state. 55 self.interpreter.state.load(self.tmpfile, force=True) 56 57 # Save the state. 58 self.interpreter.state.save(self.tmpfile, dir=None, pickle=True, force=True) 59 60 # Load the state. 61 self.interpreter.state.load(self.tmpfile, force=True)62 6365 """Test the saving, loading, and second saving and loading of the program state in XML format.""" 66 67 # Create a data pipe. 68 self.interpreter.pipe.create('test', 'mf') 69 70 # Save the state. 71 self.interpreter.state.save(self.tmpfile, pickle=False, force=True) 72 73 # Load the state. 74 self.interpreter.state.load(self.tmpfile, force=True) 75 76 # Save the state. 77 self.interpreter.state.save(self.tmpfile, pickle=False, force=True) 78 79 # Load the state. 80 self.interpreter.state.load(self.tmpfile, force=True)81 8284 """Test the writing out, and re-reading of data pipes from the state file.""" 85 86 # Create a data pipe. 87 self.interpreter.pipe.create('test', 'relax_fit') 88 89 # Reset relax. 90 reset() 91 92 # The data pipe list. 93 pipe_types = deepcopy(VALID_TYPES) 94 pipe_types.pop(pipe_types.index("frame order")) 95 96 # Create a few data pipes. 97 for i in range(len(pipe_types)): 98 self.interpreter.pipe.create('test' + repr(i), pipe_types[i]) 99 100 # Write the results. 101 self.interpreter.state.save(self.tmpfile) 102 103 # Reset relax. 104 reset() 105 106 # Re-read the results. 107 self.interpreter.state.load(self.tmpfile) 108 109 # Test the pipes. 110 for i in range(len(pipe_types)): 111 # Name. 112 name = 'test' + repr(i) 113 self.assert_(name in ds) 114 115 # Type. 116 pipe = get_pipe(name) 117 self.assertEqual(pipe.pipe_type, pipe_types[i])
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 10 14:16:50 2013 | http://epydoc.sourceforge.net |