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

Source Code for Module test_suite.unit_tests._prompt.test_model_free

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2008, 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.model_free import Model_free 
 28  from relax_errors import RelaxListStrError, RelaxNoneStrError, RelaxStrError 
 29  from test_suite.unit_tests.model_free_testing_base import Model_free_base_class 
 30   
 31  # Unit test imports. 
 32  from data_types import DATA_TYPES 
 33   
 34   
35 -class Test_model_free(Model_free_base_class, TestCase):
36 """Unit tests for the functions of the 'prompt.model_free' module.""" 37 38 # Instantiate the user function class. 39 model_free_fns = Model_free() 40 41
43 """The model arg test of the model_free.create_model() user function.""" 44 45 # Loop over the data types. 46 for data in DATA_TYPES: 47 # Catch the str argument, and skip it. 48 if data[0] == 'str': 49 continue 50 51 # The argument test. 52 self.assertRaises(RelaxStrError, self.model_free_fns.create_model, model=data[1])
53 54
56 """The equation arg test of the model_free.create_model() user function.""" 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.model_free_fns.create_model, equation=data[1])
66 67
69 """The params arg test of the model_free.create_model() user function.""" 70 71 # Loop over the data types. 72 for data in DATA_TYPES: 73 # Catch the str list argument, and skip it. 74 if data[0] == 'str list': 75 continue 76 77 # The argument test. 78 self.assertRaises(RelaxListStrError, self.model_free_fns.create_model, model='test', equation='test', params=data[1])
79 80
82 """The spin_id arg test of the model_free.create_model() user function.""" 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.model_free_fns.create_model, model='test', equation='test', params=['test'], spin_id=data[1])
92 93
95 """The spin_id arg test of the model_free.remove_tm() user function.""" 96 97 # Loop over the data types. 98 for data in DATA_TYPES: 99 # Catch the None and str arguments, and skip them. 100 if data[0] == 'None' or data[0] == 'str': 101 continue 102 103 # The argument test. 104 self.assertRaises(RelaxNoneStrError, self.model_free_fns.remove_tm, spin_id=data[1])
105 106
108 """The model arg test of the model_free.select_model() user function.""" 109 110 # Loop over the data types. 111 for data in DATA_TYPES: 112 # Catch the str argument, and skip it. 113 if data[0] == 'str': 114 continue 115 116 # The argument test. 117 self.assertRaises(RelaxStrError, self.model_free_fns.select_model, model=data[1])
118 119
121 """The spin_id arg test of the model_free.select_model() user function.""" 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.model_free_fns.select_model, model='test', spin_id=data[1])
131