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

Source Code for Module test_suite.unit_tests._prompt.test_eliminate

 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 RelaxNoneFunctionError, RelaxNoneTupleError 
28   
29  # Unit test imports. 
30  from test_suite.unit_tests._prompt.container import Container 
31  from test_suite.unit_tests._prompt.data_types import DATA_TYPES 
32   
33   
34   
35 -def dummy_function():
36 pass
37 38 39
40 -class Test_eliminate(TestCase):
41 """Unit tests for the functions of the 'prompt.eliminate' module.""" 42
43 - def __init__(self, methodName=None):
44 """Set up the test case class for the system tests.""" 45 46 # Execute the base __init__ methods. 47 super(Test_eliminate, self).__init__(methodName) 48 49 # Load the interpreter. 50 self.interpreter = Interpreter(show_script=False, raise_relax_error=True) 51 self.interpreter.populate_self() 52 self.interpreter.on(verbose=False) 53 54 # Place the user functions into a container. 55 self.eliminate_fns = Container() 56 self.eliminate_fns.eliminate = self.interpreter.eliminate
57 58
59 - def test_eliminate_function(self):
60 """The function arg unit test of the eliminate() user function.""" 61 62 # Loop over the data types. 63 for data in DATA_TYPES: 64 # Catch the None and func arguments, and skip them. 65 if data[0] == 'None' or data[0] == 'function': 66 continue 67 68 # The argument test. 69 self.assertRaises(RelaxNoneFunctionError, self.eliminate_fns.eliminate, function=data[1])
70 71
72 - def test_eliminate_args(self):
73 """The args arg unit test of the eliminate() user function.""" 74 75 # Loop over the data types. 76 for data in DATA_TYPES: 77 # Catch the None and tuple arguments, and skip them. 78 if data[0] == 'None' or data[0] == 'tuple' or data[0] == 'float tuple' or data[0] == 'str tuple': 79 continue 80 81 # The argument test. 82 self.assertRaises(RelaxNoneTupleError, self.eliminate_fns.eliminate, function=dummy_function, args=data[1])
83