Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2007,2012 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax (http://www.nmr-relax.com). # 6 # # 7 # This program 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 3 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # This program 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 this program. If not, see <http://www.gnu.org/licenses/>. # 19 # # 20 ############################################################################### 21 22 # Python module imports. 23 from unittest import TestCase 24 25 # relax module imports. 26 from prompt.interpreter import Interpreter 27 from test_suite.unit_tests.state_testing_base import State_base_class 28 from lib.errors import RelaxBoolError, RelaxIntError, RelaxStrError, RelaxStrFileError 29 30 # Unit test imports. 31 from test_suite.unit_tests._prompt.data_types import DATA_TYPES 32 3335 """Unit tests for the functions of the 'prompt.state' module.""" 3613238 """Set up the test case class for the system tests.""" 39 40 # Execute the base __init__ methods. 41 super(Test_state, self).__init__(methodName) 42 43 # Load the interpreter. 44 self.interpreter = Interpreter(show_script=False, raise_relax_error=True) 45 self.interpreter.populate_self() 46 self.interpreter.on(verbose=False) 47 48 # Alias the user function class. 49 self.state = self.interpreter.state 50 51 # Alias the user functions to work with the backend. 52 self.state.load_state = self.state.load 53 self.state.save_state = self.state.save54 5557 """Test the proper failure of the state.load() user function for the state argument.""" 58 59 # Loop over the data types. 60 for data in DATA_TYPES: 61 # Catch the str and file arguments, and skip them. 62 if data[0] == 'str' or data[0] == 'file': 63 continue 64 65 # The argument test. 66 self.assertRaises(RelaxStrFileError, self.state.load_state, state=data[1])67 6870 """Test the proper failure of the state.load() user function for the dir argument.""" 71 72 # Loop over the data types. 73 for data in DATA_TYPES: 74 # Catch the None and str arguments, and skip them. 75 if data[0] == 'None' or data[0] == 'str': 76 continue 77 78 # The argument test. 79 self.assertRaises(RelaxStrError, self.state.load_state, state='a', dir=data[1])80 8183 """Test the proper failure of the state.save() user function for the state argument.""" 84 85 # Loop over the data types. 86 for data in DATA_TYPES: 87 # Catch the str and file arguments, and skip them. 88 if data[0] == 'str' or data[0] == 'file': 89 continue 90 91 # The argument test. 92 self.assertRaises(RelaxStrFileError, self.state.save_state, state=data[1])93 9496 """Test the proper failure of the state.save() user function for the dir argument.""" 97 98 # Loop over the data types. 99 for data in DATA_TYPES: 100 # Catch the None and str arguments, and skip them. 101 if data[0] == 'None' or data[0] == 'str': 102 continue 103 104 # The argument test. 105 self.assertRaises(RelaxStrError, self.state.save_state, state='a', dir=data[1])106 107109 """Test the proper failure of the state.save() user function for the force argument.""" 110 111 # Loop over the data types. 112 for data in DATA_TYPES: 113 # Catch the bool arguments, and skip them. 114 if data[0] == 'bool': 115 continue 116 117 # The argument test. 118 self.assertRaises(RelaxBoolError, self.state.save_state, state='a', force=data[1])119 120122 """Test the proper failure of the state.save() user function for the compress_type argument.""" 123 124 # Loop over the data types. 125 for data in DATA_TYPES: 126 # Catch the int and bin arguments, and skip them. 127 if data[0] == 'int' or data[0] == 'bin': 128 continue 129 130 # The argument test. 131 self.assertRaises(RelaxIntError, self.state.save_state, state='a', compress_type=data[1])
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 8 10:44:46 2024 | http://epydoc.sourceforge.net |