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

Source Code for Module test_suite.unit_tests._prompt.test_dasha

  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 RelaxBoolError, RelaxNoneStrError, RelaxStrError 
 29   
 30  # Unit test imports. 
 31  from data_types import DATA_TYPES 
 32   
 33   
34 -class Test_dasha(TestCase):
35 """Unit tests for the functions of the 'prompt.dasha' module.""" 36
37 - def __init__(self, methodName=None):
38 """Set up the test case class for the system tests.""" 39 40 # Execute the base __init__ methods. 41 super(Test_dasha, self).__init__(methodName) 42 43 # Load the interpreter. 44 self.interpreter = Interpreter(show_script=False, quit=False, raise_relax_error=True) 45 self.interpreter.populate_self() 46 self.interpreter.on(verbose=False) 47 48 # Alias the user function class. 49 self.dasha_fns = self.interpreter.dasha
50 51
53 """Failure of the algor arg of the dasha.create() user function.""" 54 55 # Loop over the data types. 56 for data in DATA_TYPES: 57 # Catch the str argument, and skip it. 58 if data[0] == 'str': 59 continue 60 61 # The argument test. 62 self.assertRaises(RelaxStrError, self.dasha_fns.create, algor=data[1])
63 64
65 - def test_create_argfail_dir(self):
66 """Failure of the dir arg of the dasha.create() user function.""" 67 68 # Loop over the data types. 69 for data in DATA_TYPES: 70 # Catch the None and str arguments, and skip them. 71 if data[0] == 'None' or data[0] == 'str': 72 continue 73 74 # The argument test. 75 self.assertRaises(RelaxNoneStrError, self.dasha_fns.create, dir=data[1])
76 77
79 """The force arg test of the dasha.create() user function.""" 80 81 # Loop over the data types. 82 for data in DATA_TYPES: 83 # Catch the bool arguments, and skip them. 84 if data[0] == 'bool': 85 continue 86 87 # The argument test. 88 self.assertRaises(RelaxBoolError, self.dasha_fns.create, force=data[1])
89 90
91 - def test_execute_argfail_dir(self):
92 """Failure of the dir arg of the dasha.execute() user function.""" 93 94 # Loop over the data types. 95 for data in DATA_TYPES: 96 # Catch the None and str arguments, and skip them. 97 if data[0] == 'None' or data[0] == 'str': 98 continue 99 100 # The argument test. 101 self.assertRaises(RelaxNoneStrError, self.dasha_fns.execute, dir=data[1])
102 103
105 """The force arg test of the dasha.execute() user function.""" 106 107 # Loop over the data types. 108 for data in DATA_TYPES: 109 # Catch the bool arguments, and skip them. 110 if data[0] == 'bool': 111 continue 112 113 # The argument test. 114 self.assertRaises(RelaxBoolError, self.dasha_fns.execute, force=data[1])
115 116
118 """Failure of the binary arg of the dasha.execute() user function.""" 119 120 # Loop over the data types. 121 for data in DATA_TYPES: 122 # Catch the str argument, and skip it. 123 if data[0] == 'str': 124 continue 125 126 # The argument test. 127 self.assertRaises(RelaxStrError, self.dasha_fns.execute, binary=data[1])
128 129
130 - def test_extract_argfail_dir(self):
131 """Failure of the dir arg of the dasha.extract() user function.""" 132 133 # Loop over the data types. 134 for data in DATA_TYPES: 135 # Catch the None and str arguments, and skip them. 136 if data[0] == 'None' or data[0] == 'str': 137 continue 138 139 # The argument test. 140 self.assertRaises(RelaxNoneStrError, self.dasha_fns.extract, dir=data[1])
141