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

Source Code for Module test_suite.unit_tests._prompt.test_relax_fit

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2008-2014 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 lib.errors import RelaxNumError, RelaxStrError 
28   
29  # Unit test imports. 
30  from test_suite.unit_tests._prompt.data_types import DATA_TYPES 
31   
32   
33 -class Test_relax_fit(TestCase):
34 """Unit tests for the functions of the 'prompt.relax_fit' module.""" 35
36 - def __init__(self, methodName=None):
37 """Set up the test case class for the system tests.""" 38 39 # Execute the base __init__ methods. 40 super(Test_relax_fit, self).__init__(methodName) 41 42 # Load the interpreter. 43 self.interpreter = Interpreter(show_script=False, raise_relax_error=True) 44 self.interpreter.populate_self() 45 self.interpreter.on(verbose=False) 46 47 # Alias the user function class. 48 self.relax_fit_fns = self.interpreter.relax_fit
49 50
52 """The time arg test of the relax_fit.relax_time() user function.""" 53 54 # Loop over the data types. 55 for data in DATA_TYPES: 56 # Catch the float, bin, and int arguments, and skip them. 57 if data[0] == 'float' or data[0] == 'bin' or data[0] == 'int': 58 continue 59 60 # The argument test. 61 self.assertRaises(RelaxNumError, self.relax_fit_fns.relax_time, time=data[1])
62 63
65 """The spectrum_id arg test of the relax_fit.relax_time() user function.""" 66 67 # Loop over the data types. 68 for data in DATA_TYPES: 69 # Catch the str arguments, and skip them. 70 if data[0] == 'str': 71 continue 72 73 # The argument test. 74 self.assertRaises(RelaxStrError, self.relax_fit_fns.relax_time, spectrum_id=data[1])
75 76
78 """The model arg test of the relax_fit.select_model() user function.""" 79 80 # Loop over the data types. 81 for data in DATA_TYPES: 82 # Catch the str arguments, and skip them. 83 if data[0] == 'str': 84 continue 85 86 # The argument test. 87 self.assertRaises(RelaxStrError, self.relax_fit_fns.select_model, model=data[1])
88