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

Source Code for Module test_suite.gui_tests.bruker

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2012-2013 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 docstring. 
 23  """GUI tests for the Bruker Dynamics Center support.""" 
 24   
 25  # Python module imports. 
 26  from os import sep 
 27   
 28  # relax module imports. 
 29  from data_store import Relax_data_store; ds = Relax_data_store() 
 30  from pipe_control.mol_res_spin import spin_loop 
 31  from status import Status; status = Status() 
 32  from test_suite.gui_tests.base_classes import GuiTestCase 
 33  from test_suite import system_tests 
 34   
 35  # relax GUI imports. 
 36  from gui.interpreter import Interpreter; interpreter = Interpreter() 
 37  from gui.string_conv import str_to_gui 
 38   
 39   
40 -class Bruker(GuiTestCase, system_tests.bruker.Bruker):
41 """Class for testing the Bruker Dynamics Center support in the GUI.""" 42
43 - def __init__(self, methodName=None):
44 """Set up the test case class for the system tests.""" 45 46 # Force execution of the GuiTestCase __init__ method. 47 GuiTestCase.__init__(self, methodName)
48 49
50 - def setUp(self):
51 """Set up for all the GUI tests.""" 52 53 # Run the GuiTestCase setup. 54 GuiTestCase.setUp(self) 55 56 # Create a data pipe. 57 self.interpreter.pipe.create('mf', 'mf')
58 59
61 """Test the reading of a DC file, catching U{bug #20152<https://web.archive.org/web/https://gna.org/bugs/?20152>}.""" 62 63 # Simulate the new analysis wizard. 64 self.app.gui.analysis.menu_new(None) 65 page = self.app.gui.analysis.new_wizard.wizard.get_page(0) 66 page.select_mf(None) 67 page.analysis_name.SetValue(str_to_gui("Model-free test")) 68 self.app.gui.analysis.new_wizard.wizard._go_next(None) 69 page = self.app.gui.analysis.new_wizard.wizard.get_page(1) 70 self.app.gui.analysis.new_wizard.wizard._go_next(None) 71 72 # Get the data. 73 analysis_type, analysis_name, pipe_name, pipe_bundle, uf_exec = self.app.gui.analysis.new_wizard.get_data() 74 75 # Set up the analysis. 76 self.app.gui.analysis.new_analysis(analysis_type=analysis_type, analysis_name=analysis_name, pipe_name=pipe_name, pipe_bundle=pipe_bundle) 77 78 # Alias the analysis. 79 analysis = self.app.gui.analysis.get_page_from_name("Model-free test") 80 81 # Change the results directory. 82 analysis.field_results_dir.SetValue(str_to_gui(ds.tmpdir)) 83 84 # Launch the spin viewer window. 85 self.app.gui.show_tree() 86 87 # Spin loading wizard: Initialisation. 88 self.app.gui.spin_viewer.load_spins_wizard() 89 90 # Spin loading wizard: The PDB file. 91 page = self.app.gui.spin_viewer.wizard.get_page(0) 92 page.selection = 'new pdb' 93 self.app.gui.spin_viewer.wizard._go_next() 94 page = self.app.gui.spin_viewer.wizard.get_page(self.app.gui.spin_viewer.wizard._current_page) 95 page.uf_args['file'].SetValue(str_to_gui(status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'structures' + sep + '1UBQ_H_trunc.pdb')) 96 self.app.gui.spin_viewer.wizard._go_next() 97 interpreter.flush() # Required because of the asynchronous uf call. 98 99 # Spin loading wizard: The spin loading. 100 self.app.gui.spin_viewer.wizard._go_next() 101 interpreter.flush() # Required because of the asynchronous uf call. 102 103 # Close the spin viewer window. 104 self.app.gui.spin_viewer.handler_close() 105 106 # Flush the interpreter in preparation for the synchronous user functions of the peak list wizard. 107 interpreter.flush() 108 109 # The data path. 110 data_path = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'model_free' + sep + 'sphere' + sep 111 112 # Set up the Bruker DC wizard. 113 analysis.relax_data.wizard_bruker(None) 114 115 # The spectrum. 116 page = analysis.relax_data.wizard.get_page(analysis.relax_data.page_indices['read']) 117 page.uf_args['ri_id'].SetValue(str_to_gui('r1_700')) 118 page.uf_args['file'].SetValue(str_to_gui(status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'bruker_files' + sep + 'T1_demo_1UBQ_H_trunc.txt')) 119 120 # Cause the failure. 121 analysis.relax_data.wizard._go_next(None) 122 123 # Check that no data was loaded. 124 self.assert_(not hasattr(cdp, 'ri_ids')) 125 self.assert_(not hasattr(cdp, 'spectrometer_frq')) 126 self.assert_(not hasattr(cdp, 'ri_type')) 127 for spin in spin_loop(): 128 self.assert_(not hasattr(spin, 'ri_data')) 129 self.assert_(not hasattr(spin, 'ri_data_err'))
130