Package test_suite :: Package unit_tests :: Package _prompt :: Module test_residue
[hide private]
[frames] | no frames]

Source Code for Module test_suite.unit_tests._prompt.test_residue

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2007, 2010 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.residue import Residue 
 28  from relax_errors import RelaxIntError, RelaxNoneStrError, RelaxStrError 
 29  from test_suite.unit_tests.residue_testing_base import Residue_base_class 
 30   
 31  # Unit test imports. 
 32  from data_types import DATA_TYPES 
 33   
 34   
35 -class Test_residue(Residue_base_class, TestCase):
36 """Unit tests for the functions of the 'prompt.residue' module.""" 37 38 # Instantiate the user function class. 39 residue_fns = Residue() 40 41
43 """Test the proper failure of the residue.copy() user function for the pipe_from argument.""" 44 45 # Loop over the data types. 46 for data in DATA_TYPES: 47 # Catch the None and str arguments, and skip them. 48 if data[0] == 'None' or data[0] == 'str': 49 continue 50 51 # The argument test. 52 self.assertRaises(RelaxNoneStrError, self.residue_fns.copy, pipe_from=data[1], res_from='#Old mol:1', res_to='#Old mol:2')
53 54
56 """Test the proper failure of the residue.copy() user function for the res_from argument.""" 57 58 # Loop over the data types. 59 for data in DATA_TYPES: 60 # Catch the str argument, and skip it. 61 if data[0] == 'str': 62 continue 63 64 # The argument test. 65 self.assertRaises(RelaxStrError, self.residue_fns.copy, res_from=data[1], res_to='#Old mol:2')
66 67
69 """Test the proper failure of the residue.copy() user function for the pipe_to argument.""" 70 71 # Loop over the data types. 72 for data in DATA_TYPES: 73 # Catch the None and str arguments, and skip them. 74 if data[0] == 'None' or data[0] == 'str': 75 continue 76 77 # The argument test. 78 self.assertRaises(RelaxNoneStrError, self.residue_fns.copy, pipe_to=data[1], res_from='#Old mol:1', res_to='#Old mol:2')
79 80
81 - def test_copy_argfail_res_to(self):
82 """Test the proper failure of the residue.copy() user function for the res_to argument.""" 83 84 # Loop over the data types. 85 for data in DATA_TYPES: 86 # Catch the None and str arguments, and skip them. 87 if data[0] == 'None' or data[0] == 'str': 88 continue 89 90 # The argument test. 91 self.assertRaises(RelaxNoneStrError, self.residue_fns.copy, res_from='#Old mol:1@111', res_to=data[1])
92 93
95 """Test the proper failure of the residue.create() user function for the res_num argument.""" 96 97 # Loop over the data types. 98 for data in DATA_TYPES: 99 # Catch the int and bin arguments, and skip them. 100 if data[0] == 'int' or data[0] == 'bin': 101 continue 102 103 # The argument test. 104 self.assertRaises(RelaxIntError, self.residue_fns.create, res_num=data[1], res_name='NH')
105 106
108 """Test the proper failure of the residue.create() user function for the res_name argument.""" 109 110 # Loop over the data types. 111 for data in DATA_TYPES: 112 # Catch the None and str arguments, and skip them. 113 if data[0] == 'None' or data[0] == 'str': 114 continue 115 116 # The argument test. 117 self.assertRaises(RelaxNoneStrError, self.residue_fns.create, res_name=data[1], res_num=1)
118 119
121 """Test the proper failure of the residue.create() user function for the mol_name argument.""" 122 123 # Loop over the data types. 124 for data in DATA_TYPES: 125 # Catch the None and str arguments, and skip them. 126 if data[0] == 'None' or data[0] == 'str': 127 continue 128 129 # The argument test. 130 self.assertRaises(RelaxNoneStrError, self.residue_fns.create, mol_name=data[1], res_num=1, res_name='NH')
131 132
134 """Test the proper failure of the residue.delete() user function for the res_id argument.""" 135 136 # Loop over the data types. 137 for data in DATA_TYPES: 138 # Catch the str arguments, and skip them. 139 if data[0] == 'str': 140 continue 141 142 # The argument test. 143 self.assertRaises(RelaxStrError, self.residue_fns.delete, res_id=data[1])
144 145
147 """Test the proper failure of the residue.display() user function for the res_id argument.""" 148 149 # Loop over the data types. 150 for data in DATA_TYPES: 151 # Catch the None and str arguments, and skip them. 152 if data[0] == 'None' or data[0] == 'str': 153 continue 154 155 # The argument test. 156 self.assertRaises(RelaxNoneStrError, self.residue_fns.display, res_id=data[1])
157 158
159 - def test_name_argfail_res_id(self):
160 """Test the proper failure of the residue.name() user function for the res_id argument.""" 161 162 # Loop over the data types. 163 for data in DATA_TYPES: 164 # Catch the str arguments, and skip them. 165 if data[0] == 'str': 166 continue 167 168 # The argument test. 169 self.assertRaises(RelaxStrError, self.residue_fns.name, res_id=data[1])
170 171
172 - def test_name_argfail_name(self):
173 """Test the proper failure of the residue.name() user function for the name argument.""" 174 175 # Loop over the data types. 176 for data in DATA_TYPES: 177 # Catch the str arguments, and skip them. 178 if data[0] == 'str': 179 continue 180 181 # The argument test. 182 self.assertRaises(RelaxStrError, self.residue_fns.name, name=data[1])
183 184
186 """Test the proper failure of the residue.number() user function for the res_id argument.""" 187 188 # Loop over the data types. 189 for data in DATA_TYPES: 190 # Catch the str arguments, and skip them. 191 if data[0] == 'str': 192 continue 193 194 # The argument test. 195 self.assertRaises(RelaxStrError, self.residue_fns.number, res_id=data[1])
196 197
199 """Test the proper failure of the residue.number() user function for the number argument.""" 200 201 # Loop over the data types. 202 for data in DATA_TYPES: 203 # Catch the int and bin arguments, and skip them. 204 if data[0] == 'int' or data[0] == 'bin': 205 continue 206 207 # The argument test. 208 self.assertRaises(RelaxIntError, self.residue_fns.number, res_id=':1', number=data[1])
209