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 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 analysis = self.new_analysis_wizard(analysis_type='mf', analysis_name='Model-free test') 65 66 # Change the results directory. 67 analysis.field_results_dir.SetValue(str_to_gui(ds.tmpdir)) 68 69 # Launch the spin viewer window. 70 self.app.gui.show_tree() 71 72 # Spin loading wizard: Initialisation. 73 self.app.gui.spin_viewer.load_spins_wizard() 74 75 # Spin loading wizard: The PDB file. 76 page = self.app.gui.spin_viewer.wizard.get_page(0) 77 page.selection = 'new pdb' 78 self.app.gui.spin_viewer.wizard._go_next() 79 page = self.app.gui.spin_viewer.wizard.get_page(self.app.gui.spin_viewer.wizard._current_page) 80 page.uf_args['file'].SetValue(str_to_gui(status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'structures' + sep + '1UBQ_H_trunc.pdb')) 81 self.app.gui.spin_viewer.wizard._go_next() 82 interpreter.flush() # Required because of the asynchronous uf call. 83 84 # Spin loading wizard: The spin loading. 85 self.app.gui.spin_viewer.wizard._go_next() 86 interpreter.flush() # Required because of the asynchronous uf call. 87 88 # Close the spin viewer window. 89 self.app.gui.spin_viewer.handler_close() 90 91 # Flush the interpreter in preparation for the synchronous user functions of the peak list wizard. 92 interpreter.flush() 93 94 # The data path. 95 data_path = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'model_free' + sep + 'sphere' + sep 96 97 # Set up the Bruker DC wizard. 98 analysis.relax_data.wizard_bruker(None) 99 100 # The spectrum. 101 page = analysis.relax_data.wizard.get_page(analysis.relax_data.page_indices['read']) 102 page.uf_args['ri_id'].SetValue(str_to_gui('r1_700')) 103 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')) 104 105 # Cause the failure. 106 analysis.relax_data.wizard._go_next(None) 107 108 # Check that no data was loaded. 109 self.assert_(not hasattr(cdp, 'ri_ids')) 110 self.assert_(not hasattr(cdp, 'spectrometer_frq')) 111 self.assert_(not hasattr(cdp, 'ri_type')) 112 for spin in spin_loop(): 113 self.assert_(not hasattr(spin, 'ri_data')) 114 self.assert_(not hasattr(spin, 'ri_data_err'))
115