Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2007-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 unittest import TestCase 25 26 # relax module imports. 27 from prompt.interpreter import Interpreter 28 from test_suite.unit_tests.state_testing_base import State_base_class 29 from relax_errors import RelaxBoolError, RelaxIntError, RelaxNoneStrError, RelaxStrFileError 30 31 # Unit test imports. 32 from data_types import DATA_TYPES 33 3436 """Unit tests for the functions of the 'prompt.state' module.""" 3713339 """Set up the test case class for the system tests.""" 40 41 # Execute the base __init__ methods. 42 super(Test_state, self).__init__(methodName) 43 44 # Load the interpreter. 45 self.interpreter = Interpreter(show_script=False, quit=False, raise_relax_error=True) 46 self.interpreter.populate_self() 47 self.interpreter.on(verbose=False) 48 49 # Alias the user function class. 50 self.state = self.interpreter.state 51 52 # Alias the user functions to work with the backend. 53 self.state.load_state = self.state.load 54 self.state.save_state = self.state.save55 5658 """Test the proper failure of the state.load() user function for the state argument.""" 59 60 # Loop over the data types. 61 for data in DATA_TYPES: 62 # Catch the str and file arguments, and skip them. 63 if data[0] == 'str' or data[0] == 'file': 64 continue 65 66 # The argument test. 67 self.assertRaises(RelaxStrFileError, self.state.load_state, state=data[1])68 6971 """Test the proper failure of the state.load() user function for the dir argument.""" 72 73 # Loop over the data types. 74 for data in DATA_TYPES: 75 # Catch the None and str arguments, and skip them. 76 if data[0] == 'None' or data[0] == 'str': 77 continue 78 79 # The argument test. 80 self.assertRaises(RelaxNoneStrError, self.state.load_state, state='a', dir=data[1])81 8284 """Test the proper failure of the state.save() user function for the state argument.""" 85 86 # Loop over the data types. 87 for data in DATA_TYPES: 88 # Catch the str and file arguments, and skip them. 89 if data[0] == 'str' or data[0] == 'file': 90 continue 91 92 # The argument test. 93 self.assertRaises(RelaxStrFileError, self.state.save_state, state=data[1])94 9597 """Test the proper failure of the state.save() user function for the dir argument.""" 98 99 # Loop over the data types. 100 for data in DATA_TYPES: 101 # Catch the None and str arguments, and skip them. 102 if data[0] == 'None' or data[0] == 'str': 103 continue 104 105 # The argument test. 106 self.assertRaises(RelaxNoneStrError, self.state.save_state, state='a', dir=data[1])107 108110 """Test the proper failure of the state.save() user function for the force argument.""" 111 112 # Loop over the data types. 113 for data in DATA_TYPES: 114 # Catch the bool arguments, and skip them. 115 if data[0] == 'bool': 116 continue 117 118 # The argument test. 119 self.assertRaises(RelaxBoolError, self.state.save_state, state='a', force=data[1])120 121123 """Test the proper failure of the state.save() user function for the compress_type argument.""" 124 125 # Loop over the data types. 126 for data in DATA_TYPES: 127 # Catch the int and bin arguments, and skip them. 128 if data[0] == 'int' or data[0] == 'bin': 129 continue 130 131 # The argument test. 132 self.assertRaises(RelaxIntError, self.state.save_state, state='a', compress_type=data[1])
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 10 14:17:01 2013 | http://epydoc.sourceforge.net |