Package test_suite :: Package gui_tests :: Module test_user_functions
[hide private]
[frames] | no frames]

Source Code for Module test_suite.gui_tests.test_user_functions

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2012,2014,2016,2019 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  """Module for testing the special features of the user function GUI windows.""" 
 23   
 24  # Python module imports. 
 25  from os import path, sep 
 26  import sys 
 27   
 28  # relax module imports. 
 29  from status import Status; status = Status() 
 30  from test_suite.gui_tests.base_classes import GuiTestCase 
 31   
 32  # relax GUI imports. 
 33  from gui.interpreter import Interpreter; interpreter = Interpreter() 
 34  from gui.string_conv import float_to_gui, int_to_gui, str_to_gui 
 35  from gui.uf_objects import Uf_storage; uf_store = Uf_storage() 
 36   
 37   
38 -class User_functions(GuiTestCase):
39 """Class for testing special features of the user function GUI windows.""" 40
41 - def exec_uf_pipe_create(self, pipe_name=None, pipe_type='mf'):
42 """Execute the pipe.create user function via the GUI user function window. 43 44 @keyword pipe_name: The pipe_name argument of the pipe.create user function. 45 @type pipe_name: str 46 @keyword pipe_type: The pipe_type argument of the pipe.create user function. 47 @type pipe_type: str 48 """ 49 50 # Open the pipe.create user function window. 51 uf = uf_store['pipe.create'] 52 uf._sync = True 53 uf.create_wizard(parent=self.app.gui) 54 55 # Set the arguments. 56 uf.page.SetValue('pipe_name', str_to_gui(pipe_name)) 57 uf.page.SetValue('pipe_type', str_to_gui(pipe_type)) 58 59 # Execute. 60 uf.wizard._go_next(None)
61 62
64 """Catch U{bug #2<https://sourceforge.net/p/nmr-relax/tickets/2/>}, the failure of the structure.read_pdb user function. 65 66 This was reported by U{Stefano Ciurli<https://sourceforge.net/u/stefanociurli/>}. 67 """ 68 69 # Create the data pipe. 70 self.exec_uf_pipe_create(pipe_name='structure.read_pdb user function failure test') 71 72 # Open the structure.read_pdb user function window. 73 uf = uf_store['structure.read_pdb'] 74 uf._sync = True 75 uf.create_wizard(parent=self.app.gui) 76 77 # The PDB file. 78 file = path.join(status.install_path, 'test_suite', 'shared_data', 'structures', '1J7O.pdb') 79 80 # Manually set the PDB file on the first text element - as this is not attached to a uf_args dictionary element! 81 uf.page.GetChildren()[6].SetValue(str_to_gui(file)) 82 83 # Execute the user function. 84 uf.wizard._go_next(None) 85 86 # Check the structural data. 87 self.assert_(hasattr(cdp, 'structure')) 88 self.assert_(hasattr(cdp.structure, 'structural_data')) 89 self.assertEqual(len(cdp.structure.structural_data), 3) 90 self.assertEqual(cdp.structure.structural_data[0].num, 1) 91 self.assertEqual(cdp.structure.structural_data[1].num, 2) 92 self.assertEqual(cdp.structure.structural_data[2].num, 3)
93 94
96 """Catch U{bug #3<https://sourceforge.net/p/nmr-relax/tickets/3/>}, the absence of user function argument validation in the GUI. 97 98 Without argument validation, the structure.read_pdb user function would fail with the error:: 99 100 relax> pipe.create(pipe_name='validation_test', pipe_type='mf', bundle=None) 101 102 relax> structure.read_pdb(file=None, dir=None, read_mol=None, set_mol_name=None, read_model=None, set_model_num=None, alt_loc=None, verbosity=1, merge=False) 103 Traceback (most recent call last): 104 File "/data/relax/relax/gui/interpreter.py", line 306, in run 105 fn(*args, **kwds) 106 File "/data/relax/relax/pipe_control/structure/main.py", line 1277, in read_pdb 107 if not access(file_path, F_OK): 108 TypeError: coercing to Unicode: need string or buffer, NoneType found 109 110 However with validation, a RelaxStrFileError error is raised. This is caught by the GUI, presenting a pop up window for the error, printing out the error text, but not raising the error. Hence an error cannot be caught. 111 """ 112 113 # Create the data pipe. 114 self.exec_uf_pipe_create(pipe_name='user function argument validation test') 115 116 # Open the structure.read_pdb user function window. 117 uf = uf_store['structure.read_pdb'] 118 uf._sync = True 119 uf.create_wizard(parent=self.app.gui) 120 121 # Execute the user function with no arguments set. 122 uf.wizard._go_next(None)
123 124
125 - def test_dx_map(self):
126 """Test the operation of the dx.map user function GUI window.""" 127 128 # Open the dx.map user function window. 129 uf = uf_store['dx.map'] 130 uf._sync = True 131 uf.create_wizard(parent=self.app.gui) 132 133 # Set the y-value of a single point, and check. 134 uf.page.uf_args['point'].selection_win_show() 135 uf.page.uf_args['point'].sel_win.sequence.SetStringItem(0, 2, int_to_gui(2)) 136 uf.page.uf_args['point'].selection_win_data() 137 points = uf.page.uf_args['point'].GetValue() 138 print("Points: %s" % points) 139 self.assertEqual(len(points), 1) 140 self.assertEqual(len(points[0]), 3) 141 self.assertEqual(points[0][0], None) 142 self.assertEqual(points[0][1], 2.0) 143 self.assertEqual(points[0][2], None) 144 145 # Set the point to nothing in the wizard, open the Sequence_2D window, close the window, and check that None comes back. 146 uf.page.uf_args['point'].SetValue(str_to_gui('')) 147 uf.page.uf_args['point'].selection_win_show() 148 uf.page.uf_args['point'].selection_win_data() 149 points = uf.page.uf_args['point'].GetValue() 150 print("Points: %s" % points) 151 self.assertEqual(points, None) 152 153 # Set a valid point in the wizard, open and close the Sequence_2D window (twice), and check that the point comes back. 154 uf.page.uf_args['point'].SetValue(str_to_gui('[[1, 2, -3.]]')) 155 uf.page.uf_args['point'].selection_win_show() 156 uf.page.uf_args['point'].selection_win_data() 157 uf.page.uf_args['point'].selection_win_show() 158 uf.page.uf_args['point'].selection_win_data() 159 points = uf.page.uf_args['point'].GetValue() 160 print("Points: %s" % points) 161 self.assertEqual(len(points), 1) 162 self.assertEqual(len(points[0]), 3) 163 self.assertEqual(points[0][0], 1.0) 164 self.assertEqual(points[0][1], 2.0) 165 self.assertEqual(points[0][2], -3.0) 166 167 # Set 2 valid points in the wizard, open and close the Sequence_2D window (twice), and check that the points come back. 168 uf.page.uf_args['point'].SetValue(str_to_gui('[[1, 2, 3], [-2, -3, -4]]')) 169 uf.page.uf_args['point'].selection_win_show() 170 uf.page.uf_args['point'].selection_win_data() 171 uf.page.uf_args['point'].selection_win_show() 172 uf.page.uf_args['point'].selection_win_data() 173 points = uf.page.uf_args['point'].GetValue() 174 print("Points: %s" % points) 175 self.assertEqual(len(points), 2) 176 self.assertEqual(len(points[0]), 3) 177 self.assertEqual(len(points[1]), 3) 178 self.assertEqual(points[0][0], 1.0) 179 self.assertEqual(points[0][1], 2.0) 180 self.assertEqual(points[0][2], 3.0) 181 self.assertEqual(points[1][0], -2.0) 182 self.assertEqual(points[1][1], -3.0) 183 self.assertEqual(points[1][2], -4.0) 184 185 # Set the points to a number of invalid values, checking that they are ignored. 186 for val in ['2', 'die', '[1, 2, 3', '[1]', '[[1, 2, 3], 1, 2, 3], [1, 2, 3]]']: 187 uf.page.uf_args['point'].SetValue(str_to_gui(val)) 188 uf.page.uf_args['point'].selection_win_show() 189 uf.page.uf_args['point'].selection_win_data() 190 points = uf.page.uf_args['point'].GetValue() 191 print("Points: %s" % points) 192 self.assertEqual(points, None) 193 194 # Set the Sequence_2D elements to invalid values. 195 for val in ['x']: 196 uf.page.uf_args['point'].SetValue(str_to_gui('')) 197 uf.page.uf_args['point'].selection_win_show() 198 uf.page.uf_args['point'].sel_win.sequence.SetStringItem(0, 2, str_to_gui(val)) 199 uf.page.uf_args['point'].sel_win.sequence.SetStringItem(0, 1, int_to_gui(1)) 200 uf.page.uf_args['point'].selection_win_data() 201 points = uf.page.uf_args['point'].GetValue() 202 print("Points: %s" % points) 203 self.assertEqual(len(points), 1) 204 self.assertEqual(len(points[0]), 3) 205 self.assertEqual(points[0][0], 1.0) 206 self.assertEqual(points[0][1], None) 207 self.assertEqual(points[0][2], None)
208 209
211 """Test the operation of the spectrum.read_intensities user function GUI window.""" 212 213 # Open the spectrum.read_intensities user function window. 214 uf = uf_store['spectrum.read_intensities'] 215 uf._sync = True 216 uf.create_wizard(parent=self.app.gui) 217 218 # Set the y-value of a single pos, and check. 219 uf.page.uf_args['file'].selection_win_show() 220 uf.page.uf_args['file'].sel_win.SetValue('test_file') 221 uf.page.uf_args['file'].selection_win_data() 222 file = uf.page.uf_args['file'].GetValue() 223 print("File names: %s" % file) 224 self.assert_(isinstance(file, str)) 225 self.assertEqual(file, 'test_file') 226 227 # Set the file to nothing in the wizard, open the Sequence window, close the window, and check that None comes back. 228 uf.page.uf_args['file'].SetValue(str_to_gui('')) 229 uf.page.uf_args['file'].selection_win_show() 230 uf.page.uf_args['file'].selection_win_data() 231 file = uf.page.uf_args['file'].GetValue() 232 print("File names: %s" % file) 233 self.assertEqual(file, None) 234 235 # Set a valid file list in the wizard, open and close the Sequence window (twice), and check that the file comes back. 236 uf.page.uf_args['file'].SetValue(str_to_gui("['test1', 'test2']")) 237 uf.page.uf_args['file'].selection_win_show() 238 uf.page.uf_args['file'].selection_win_data() 239 uf.page.uf_args['file'].selection_win_show() 240 uf.page.uf_args['file'].selection_win_data() 241 file = uf.page.uf_args['file'].GetValue() 242 print("File names: %s" % file) 243 self.assertEqual(len(file), 2) 244 self.assertEqual(file[0], 'test1') 245 self.assertEqual(file[1], 'test2') 246 247 # Set the file to a number of invalid values, checking that they are ignored. 248 for val in ["['1', '2', '3'", "['1'"]: 249 uf.page.uf_args['file'].SetValue(str_to_gui(val)) 250 uf.page.uf_args['file'].selection_win_show() 251 uf.page.uf_args['file'].selection_win_data() 252 file = uf.page.uf_args['file'].GetValue() 253 print("Invalid file: %s\nFile names: %s" % (val, file)) 254 self.assertEqual(file, None)
255 256
257 - def test_structure_add_atom(self):
258 """Test the operation of the structure.add_atom user function GUI window.""" 259 260 # Open the structure.add_atom user function window. 261 uf = uf_store['structure.add_atom'] 262 uf._sync = True 263 uf.create_wizard(parent=self.app.gui) 264 265 # Set the y-value of a single pos, and check. 266 #uf.page.uf_args['pos'].selection_win_show() 267 #uf.page.uf_args['pos'].sel_win.sequence.SetStringItem(1, 1, int_to_gui(2)) 268 #uf.page.uf_args['pos'].selection_win_data() 269 #pos = uf.page.uf_args['pos'].GetValue() 270 #print("Pos: %s" % pos) 271 #self.assertEqual(len(pos), 3) 272 #self.assertEqual(pos[0], None) 273 #self.assertEqual(pos[1], 2.0) 274 #self.assertEqual(pos[2], None) 275 276 # Set the pos to nothing in the wizard, open the Sequence window, close the window, and check that None comes back. 277 val = '' 278 sys.stdout.write("Value: %40s; " % repr(val)) 279 uf.page.uf_args['pos'].SetValue(str_to_gui(val)) 280 uf.page.uf_args['pos'].selection_win_show() 281 uf.page.uf_args['pos'].selection_win_data() 282 pos = uf.page.uf_args['pos'].GetValue() 283 sys.stdout.write("Return: %40s\n" % repr(pos)) 284 self.assertEqual(pos, None) 285 286 # Set a valid pos in the wizard, open and close the Sequence window (twice), and check that the pos comes back. 287 val = '[1, 2, -3.]' 288 sys.stdout.write("Value: %40s; " % repr(val)) 289 uf.page.uf_args['pos'].SetValue(str_to_gui(val)) 290 uf.page.uf_args['pos'].selection_win_show() 291 uf.page.uf_args['pos'].selection_win_data() 292 uf.page.uf_args['pos'].selection_win_show() 293 uf.page.uf_args['pos'].selection_win_data() 294 pos = uf.page.uf_args['pos'].GetValue() 295 sys.stdout.write("Return: %40s\n" % repr(pos)) 296 self.assertEqual(len(pos), 1) 297 self.assertEqual(len(pos[0]), 3) 298 self.assertEqual(pos[0][0], 1.0) 299 self.assertEqual(pos[0][1], 2.0) 300 self.assertEqual(pos[0][2], -3.0) 301 302 # Set the pos to a number of invalid values, checking that they are ignored. 303 for val in ['die', '[1, 2, 3', '[[1, 2, 3], 1, 2, 3], [1, 2, 3]]']: 304 sys.stdout.write("Value: %40s; " % repr(val)) 305 uf.page.uf_args['pos'].SetValue(str_to_gui(val)) 306 uf.page.uf_args['pos'].selection_win_show() 307 uf.page.uf_args['pos'].selection_win_data() 308 pos = uf.page.uf_args['pos'].GetValue() 309 sys.stdout.write("Return: %40s\n" % repr(pos)) 310 self.assertEqual(pos, None) 311 312 # Set the Sequence elements to invalid values. 313 for val in ['x']: 314 sys.stdout.write("Value: %40s; " % repr(val)) 315 uf.page.uf_args['pos'].SetValue(str_to_gui('')) 316 uf.page.uf_args['pos'].selection_win_show() 317 uf.page.uf_args['pos'].sel_win.add_element() 318 uf.page.uf_args['pos'].sel_win.sequence.SetStringItem(1, 1, str_to_gui(val)) 319 uf.page.uf_args['pos'].sel_win.sequence.SetStringItem(0, 1, int_to_gui(1)) 320 uf.page.uf_args['pos'].selection_win_data() 321 pos = uf.page.uf_args['pos'].GetValue() 322 sys.stdout.write("Return: %40s\n" % repr(pos)) 323 #self.assertEqual(len(pos), 1) 324 self.assertEqual(pos[0][0], 1.0)
325 #self.assertEqual(pos[0][1], None) 326 #self.assertEqual(pos[0][2], None) 327 328
329 - def test_structure_pdb_read(self):
330 """Test the full operation of the structure.read_pdb user function GUI window.""" 331 332 # Create the data pipe. 333 self.exec_uf_pipe_create(pipe_name='PDB reading test') 334 335 # Open the structure.read_pdb user function window. 336 uf = uf_store['structure.read_pdb'] 337 uf._sync = True 338 uf.create_wizard(parent=self.app.gui) 339 340 # The PDB file to operate on. 341 file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'structures' + sep + 'trunc_ubi_pcs.pdb' 342 uf.page.SetValue('file', str_to_gui(file)) 343 344 # Set the models to read. 345 uf.page.SetValue('read_model', str_to_gui('6')) 346 uf.page.uf_args['read_model'].selection_win_show() 347 uf.page.uf_args['read_model'].sel_win.add_element(None) 348 uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(0, 1, int_to_gui(2)) 349 uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(1, 1, int_to_gui(4)) 350 uf.page.uf_args['read_model'].selection_win_data() 351 352 # Renumber the models. 353 uf.page.uf_args['set_model_num'].selection_win_show() 354 uf.page.uf_args['set_model_num'].sel_win.add_element(None) 355 uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(0, 1, int_to_gui(1)) 356 uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(1, 1, int_to_gui(3)) 357 uf.page.uf_args['set_model_num'].selection_win_data() 358 359 # GUI data checks. 360 self.assertEqual(uf.page.uf_args['read_model'].GetValue(), [2, 4]) 361 self.assertEqual(uf.page.uf_args['set_model_num'].GetValue(), [1, 3]) 362 363 # Execute the user function. 364 uf.wizard._go_next(None) 365 366 # Check the structural data. 367 self.assert_(hasattr(cdp, 'structure')) 368 self.assert_(hasattr(cdp.structure, 'structural_data')) 369 self.assertEqual(len(cdp.structure.structural_data), 2) 370 self.assertEqual(cdp.structure.structural_data[0].num, 1) 371 self.assertEqual(cdp.structure.structural_data[1].num, 3)
372 373
374 - def test_structure_rotate(self):
375 """Test the operation of the structure.rotate user function GUI window.""" 376 377 # Create the data pipe. 378 self.exec_uf_pipe_create(pipe_name='PDB rotation test') 379 380 # Open the structure.read_pdb user function window. 381 uf = uf_store['structure.read_pdb'] 382 uf._sync = True 383 uf.create_wizard(parent=self.app.gui) 384 385 # The PDB file to operate on. 386 file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'structures' + sep + 'trunc_ubi_pcs.pdb' 387 uf.page.SetValue('file', str_to_gui(file)) 388 389 # Set the models to read. 390 uf.page.SetValue('read_model', str_to_gui('6')) 391 uf.page.uf_args['read_model'].selection_win_show() 392 uf.page.uf_args['read_model'].sel_win.add_element(None) 393 uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(0, 1, int_to_gui(2)) 394 uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(1, 1, int_to_gui(4)) 395 uf.page.uf_args['read_model'].selection_win_data() 396 397 # Renumber the models. 398 uf.page.uf_args['set_model_num'].selection_win_show() 399 uf.page.uf_args['set_model_num'].sel_win.add_element(None) 400 uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(0, 1, int_to_gui(1)) 401 uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(1, 1, int_to_gui(3)) 402 uf.page.uf_args['set_model_num'].selection_win_data() 403 404 # GUI data checks. 405 self.assertEqual(uf.page.uf_args['read_model'].GetValue(), [2, 4]) 406 self.assertEqual(uf.page.uf_args['set_model_num'].GetValue(), [1, 3]) 407 408 # Execute the user function. 409 uf.wizard._go_next(None) 410 411 # Open the structure.rotate user function window. 412 uf = uf_store['structure.rotate'] 413 uf._sync = True 414 uf.create_wizard(parent=self.app.gui) 415 416 # Change the rotation matrix in the Sequence_2D window, without changing anything, then check it. 417 uf.page.uf_args['R'].selection_win_show() 418 uf.page.uf_args['R'].sel_win.sequence.SetStringItem(1, 1, int_to_gui(2)) 419 uf.page.uf_args['R'].selection_win_data() 420 R = uf.page.uf_args['R'].GetValue() 421 print("Rotation matrix:\n%s" % R) 422 self.assertEqual(len(R), 3) 423 self.assertEqual(len(R[0]), 3) 424 self.assertEqual(R[0][0], 1) 425 self.assertEqual(R[0][1], 0) 426 self.assertEqual(R[0][2], 0) 427 self.assertEqual(R[1][0], 0) 428 self.assertEqual(R[1][1], 2) 429 self.assertEqual(R[1][2], 0) 430 self.assertEqual(R[2][0], 0) 431 self.assertEqual(R[2][1], 0) 432 self.assertEqual(R[2][2], 1) 433 434 # Set the rotation matrix to nothing in the wizard, open the Sequence_2D window, set a value, close the window, and check what happens. 435 uf.page.uf_args['R'].SetValue(str_to_gui('')) 436 uf.page.uf_args['R'].selection_win_show() 437 uf.page.uf_args['R'].sel_win.sequence.SetStringItem(1, 1, int_to_gui(2)) 438 uf.page.uf_args['R'].selection_win_data() 439 R = uf.page.uf_args['R'].GetValue() 440 print("Rotation matrix:\n%s" % R) 441 self.assertEqual(len(R), 3) 442 self.assertEqual(len(R[0]), 3) 443 self.assertEqual(R[0][0], None) 444 self.assertEqual(R[0][1], None) 445 self.assertEqual(R[0][2], None) 446 self.assertEqual(R[1][0], None) 447 self.assertEqual(R[1][1], 2) 448 self.assertEqual(R[1][2], None) 449 self.assertEqual(R[2][0], None) 450 self.assertEqual(R[2][1], None) 451 self.assertEqual(R[2][2], None) 452 453 # Set the rotation matrix to nothing in the wizard, open the Sequence_2D window, close the window, and check that None comes back. 454 uf.page.uf_args['R'].SetValue(str_to_gui('')) 455 uf.page.uf_args['R'].selection_win_show() 456 uf.page.uf_args['R'].selection_win_data() 457 R = uf.page.uf_args['R'].GetValue() 458 print("Rotation matrix:\n%s" % R) 459 self.assertEqual(R, None) 460 461 # Set the rotation matrix to a number of invalid values, checking that they are ignored. 462 for val in ['2', 'die', '[1, 2, 3]', '[1]', '[[1, 2, 3], 1, 2, 3], [1, 2, 3]]']: 463 uf.page.uf_args['R'].SetValue(str_to_gui(val)) 464 uf.page.uf_args['R'].selection_win_show() 465 uf.page.uf_args['R'].selection_win_data() 466 R = uf.page.uf_args['R'].GetValue() 467 print("Rotation matrix:\n%s" % R) 468 self.assertEqual(R, None) 469 470 # Set the Sequence_2D elements to invalid values. 471 for val in ['x']: 472 uf.page.uf_args['R'].SetValue(str_to_gui('')) 473 uf.page.uf_args['R'].selection_win_show() 474 uf.page.uf_args['R'].sel_win.sequence.SetStringItem(1, 1, str_to_gui(val)) 475 uf.page.uf_args['R'].sel_win.sequence.SetStringItem(0, 0, int_to_gui(1)) 476 uf.page.uf_args['R'].selection_win_data() 477 R = uf.page.uf_args['R'].GetValue() 478 print("Rotation matrix:\n%s" % R) 479 self.assertEqual(len(R), 3) 480 self.assertEqual(len(R[0]), 3) 481 self.assertEqual(R[0][0], 1.0) 482 self.assertEqual(R[0][1], None) 483 self.assertEqual(R[0][2], None) 484 self.assertEqual(R[1][0], None) 485 self.assertEqual(R[1][1], None) 486 self.assertEqual(R[1][2], None) 487 self.assertEqual(R[2][0], None) 488 self.assertEqual(R[2][1], None) 489 self.assertEqual(R[2][2], None) 490 491 # Check the structural data. 492 self.assert_(hasattr(cdp, 'structure')) 493 self.assert_(hasattr(cdp.structure, 'structural_data')) 494 self.assertEqual(len(cdp.structure.structural_data), 2) 495 self.assertEqual(cdp.structure.structural_data[0].num, 1) 496 self.assertEqual(cdp.structure.structural_data[1].num, 3)
497 498
499 - def test_value_set(self):
500 """Test the full operation of the value.set user function GUI window.""" 501 502 # Create the data pipe. 503 self.exec_uf_pipe_create(pipe_name='value.set user function test') 504 505 # Create a spin to add data to. 506 uf = uf_store['spin.create'] 507 uf._sync = True 508 uf.create_wizard(parent=self.app.gui) 509 uf.page.SetValue('res_num', int_to_gui(1)) 510 uf.page.SetValue('res_name', str_to_gui('Gly')) 511 uf.page.SetValue('spin_name', str_to_gui('N')) 512 uf.wizard._go_next(None) 513 514 # Open the value.set user function window. 515 uf = uf_store['value.set'] 516 uf._sync = True 517 uf.create_wizard(parent=self.app.gui) 518 uf.page.SetValue('val', float_to_gui(-0.000172)) 519 uf.page.SetValue('param', str_to_gui('csa')) 520 uf.wizard._go_next(None)
521