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