1   
  2   
  3   
  4   
  5   
  6   
  7   
  8   
  9   
 10   
 11   
 12   
 13   
 14   
 15   
 16   
 17   
 18   
 19   
 20   
 21   
 22   
 23  from unittest import TestCase 
 24   
 25   
 26  from prompt.interpreter import Interpreter 
 27  from relax_errors import RelaxNoneStrError, RelaxStrError 
 28  from test_suite.unit_tests.molecule_testing_base import Molecule_base_class 
 29   
 30   
 31  from test_suite.unit_tests._prompt.data_types import DATA_TYPES 
 32   
 33   
 35      """Unit tests for the functions of the 'prompt.molecule' module.""" 
 36   
 50   
 51   
 53          """Test the proper failure of the molecule.copy() user function for the pipe_from argument.""" 
 54   
 55           
 56          for data in DATA_TYPES: 
 57               
 58              if data[0] == 'None' or data[0] == 'str': 
 59                  continue 
 60   
 61               
 62              self.assertRaises(RelaxNoneStrError, self.molecule_fns.copy, pipe_from=data[1], mol_from='#Old mol', mol_to='#Old mol') 
  63   
 64   
 66          """Test the proper failure of the molecule.copy() user function for the mol_from argument.""" 
 67   
 68           
 69          for data in DATA_TYPES: 
 70               
 71              if data[0] == 'str': 
 72                  continue 
 73   
 74               
 75              self.assertRaises(RelaxStrError, self.molecule_fns.copy, mol_from=data[1], mol_to='#Old mol') 
  76   
 77   
 79          """Test the proper failure of the molecule.copy() user function for the pipe_to argument.""" 
 80   
 81           
 82          for data in DATA_TYPES: 
 83               
 84              if data[0] == 'None' or data[0] == 'str': 
 85                  continue 
 86   
 87               
 88              self.assertRaises(RelaxNoneStrError, self.molecule_fns.copy, pipe_to=data[1], mol_from='#Old mol', mol_to='#New mol2') 
  89   
 90   
 92          """Test the proper failure of the molecule.copy() user function for the mol_to argument.""" 
 93   
 94           
 95          self.setup_data() 
 96   
 97           
 98          for data in DATA_TYPES: 
 99               
100              if data[0] == 'None' or data[0] == 'str': 
101                  continue 
102   
103               
104              self.assertRaises(RelaxNoneStrError, self.molecule_fns.copy, mol_from='#Old mol', mol_to=data[1]) 
 105   
106   
108          """Test the proper failure of the molecule.create() user function for the mol_name argument.""" 
109   
110           
111          for data in DATA_TYPES: 
112               
113              if data[0] == 'str': 
114                  continue 
115   
116               
117              self.assertRaises(RelaxStrError, self.molecule_fns.create, mol_name=data[1]) 
 118   
119   
121          """Test the proper failure of the molecule.delete() user function for the mol_id argument.""" 
122   
123           
124          for data in DATA_TYPES: 
125               
126              if data[0] == 'str': 
127                  continue 
128   
129               
130              self.assertRaises(RelaxStrError, self.molecule_fns.delete, mol_id=data[1]) 
 131   
132   
134          """Test the proper failure of the molecule.display() user function for the mol_id argument.""" 
135   
136           
137          for data in DATA_TYPES: 
138               
139              if data[0] == 'None' or data[0] == 'str': 
140                  continue 
141   
142               
143              self.assertRaises(RelaxNoneStrError, self.molecule_fns.display, mol_id=data[1]) 
 144   
145   
147          """Test the proper failure of the molecule.name() user function for the mol_id argument.""" 
148   
149           
150          for data in DATA_TYPES: 
151               
152              if data[0] == 'None' or data[0] == 'str': 
153                  continue 
154   
155               
156              self.assertRaises(RelaxNoneStrError, self.molecule_fns.name, mol_id=data[1]) 
 157   
158   
160          """Test the proper failure of the molecule.name() user function for the name argument.""" 
161   
162           
163          for data in DATA_TYPES: 
164               
165              if data[0] == 'str': 
166                  continue 
167   
168               
169              self.assertRaises(RelaxStrError, self.molecule_fns.name, name=data[1]) 
  170