mailr13776 - in /branches/gui_testing/test_suite/gui_tests: __init__.py state.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on July 20, 2011 - 15:00:
Author: bugman
Date: Wed Jul 20 15:00:05 2011
New Revision: 13776

URL: http://svn.gna.org/viewcvs/relax?rev=13776&view=rev
Log:
Created a GUI test for loading a relax save state file created in a non-GUI 
mode.


Added:
    branches/gui_testing/test_suite/gui_tests/state.py
      - copied, changed from r13749, 
branches/gui_testing/test_suite/gui_tests/noe.py
Modified:
    branches/gui_testing/test_suite/gui_tests/__init__.py

Modified: branches/gui_testing/test_suite/gui_tests/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/test_suite/gui_tests/__init__.py?rev=13776&r1=13775&r2=13776&view=diff
==============================================================================
--- branches/gui_testing/test_suite/gui_tests/__init__.py (original)
+++ branches/gui_testing/test_suite/gui_tests/__init__.py Wed Jul 20 15:00:05 
2011
@@ -34,11 +34,13 @@
 # relax GUI test module imports.
 from noe import Noe
 from rx import Rx
+from state import State
 from test_suite.relax_test_loader import RelaxTestLoader as TestLoader
 
 
 __all__ = ['noe',
-           'rx']
+           'rx',
+           'state']
 
 
 class GUI_test_runner:
@@ -79,6 +81,7 @@
         if not tests:
             suite_array.append(TestLoader().loadTestsFromTestCase(Noe))
             suite_array.append(TestLoader().loadTestsFromTestCase(Rx))
+            suite_array.append(TestLoader().loadTestsFromTestCase(State))
 
         # Group all tests together.
         full_suite = TestSuite(suite_array)

Copied: branches/gui_testing/test_suite/gui_tests/state.py (from r13749, 
branches/gui_testing/test_suite/gui_tests/noe.py)
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/test_suite/gui_tests/state.py?p2=branches/gui_testing/test_suite/gui_tests/state.py&p1=branches/gui_testing/test_suite/gui_tests/noe.py&r1=13749&r2=13776&rev=13776&view=diff
==============================================================================
--- branches/gui_testing/test_suite/gui_tests/noe.py (original)
+++ branches/gui_testing/test_suite/gui_tests/state.py Wed Jul 20 15:00:05 
2011
@@ -37,134 +37,27 @@
 from gui.wizard import Wiz_window
 
 
-class Noe(GuiTestCase):
-    """Class for testing various aspects specific to the NOE analysis."""
+class State(GuiTestCase):
+    """Class for testing various aspects specific to saved states."""
 
-    def test_noe_analysis(self):
-        """Test the NOE analysis."""
+    def test_load_state_no_gui(self):
+        """Test the loading of a relax save state with no GUI data."""
 
-        # Simulate the new analysis wizard.
-        self.gui.analysis.menu_new(None)
-        page = self.gui.analysis.new_wizard.wizard.get_page(0)
-        page.select_noe(None)
-        self.gui.analysis.new_wizard.wizard._go_next(None)
-        page = self.gui.analysis.new_wizard.wizard.get_page(1)
-        self.gui.analysis.new_wizard.wizard._go_next(None)
+        # Simulate the 'Open relax state' menu entry.
+        file = status.install_path + sep + 'test_suite' + sep + 
'shared_data' + sep + 'model_free' + sep + 'OMP' + sep + 
'final_results_trunc_1.3'
+        self.gui.state_load(file_name=file)
 
-        # Get the data.
-        analysis_type, analysis_name, pipe_name = 
self.gui.analysis.new_wizard.get_data()
+        # The index.
+        index = 0
 
-        # Set up the analysis.
-        self.gui.analysis.new_analysis(analysis_type=analysis_type, 
analysis_name=analysis_name, pipe_name=pipe_name)
+        # Test that the model-free analysis tab is loaded.
+        self.assert_(not self.gui.analysis.init_state)
+        self.assertEqual(self.gui.analysis._num_analyses, 1)
+        self.assertEqual(len(self.gui.analysis._analyses), 1)
+        self.assertEqual(self.gui.analysis.notebook.GetPageCount(), 1)
+        self.assert_(self.gui.analysis._analyses[index].init_flag)
 
-        # Alias the analysis.
-        analysis = self.gui.analysis.get_page_from_name("Steady-state NOE")
-
-        # The frequency label.
-        analysis.field_nmr_frq.SetValue(str_to_gui('500'))
-
-        # Change the results directory.
-        analysis.field_results_dir.SetValue(str_to_gui(ds.tmpdir))
-
-        # Load the sequence.
-        wizard = Wiz_window()
-        seq_read = sequence.Read_page(wizard, self.gui)
-        file = status.install_path + sep + 'test_suite' + sep + 
'shared_data' + sep + 'Ap4Aase.seq'
-        seq_read.file.SetValue(str_to_gui(file))
-        seq_read.mol_name_col.SetValue(int_to_gui(None))
-        seq_read.res_name_col.SetValue(int_to_gui(2))
-        seq_read.res_num_col.SetValue(int_to_gui(1))
-        seq_read.spin_name_col.SetValue(int_to_gui(None))
-        seq_read.spin_num_col.SetValue(int_to_gui(None))
-        seq_read.on_execute()
-
-        # Unresolved spins.
-        deselect_spin = deselect.Spin_page(wizard, self.gui)
-        deselect_spin.spin_id.SetValue(str_to_gui(":3"))
-        deselect_spin.on_execute()
-
-        # Name the spins.
-        page = spin.Name_page(wizard, self.gui)
-        page.name.SetValue(str_to_gui('N'))
-        page.on_execute()
-
-        # The intensity data.
-        ids = ['ref', 'sat']
-        files = [
-            status.install_path + sep + 'test_suite' + sep + 'shared_data' + 
sep + 'peak_lists' + sep + 'ref_ave.list',
-            status.install_path + sep + 'test_suite' + sep + 'shared_data' + 
sep + 'peak_lists' + sep + 'sat_ave.list'
-        ]
-        errors = [3600, 3000]
-        types = [1, 0]
-
-        # Loop over the 2 spectra.
-        for i in range(2):
-            # Set up the peak intensity wizard.
-            analysis.peak_wizard(None)
-
-            # The spectrum.
-            page = analysis.wizard.get_page(analysis.page_indices['read'])
-            page.file.SetValue(str_to_gui(files[i]))
-            page.spectrum_id.SetValue(str_to_gui(ids[i]))
-            page.proton.SetValue(str_to_gui('HN'))
-
-            # Move down 2 pages.
-            analysis.wizard._go_next(None)
-            analysis.wizard._go_next(None)
-
-            # Set the errors.
-            page = analysis.wizard.get_page(analysis.page_indices['rmsd'])
-            page.error.SetValue(int_to_gui(errors[i]))
-
-            # Go to the next page.
-            analysis.wizard._go_next(None)
-
-            # Set the type.
-            page = 
analysis.wizard.get_page(analysis.page_indices['spectrum_type'])
-            page.spectrum_type.SetSelection(types[i])
-
-            # Go to the next page (i.e. finish).
-            analysis.wizard._go_next(None)
-
-        # Execute relax.
-        analysis.execute(wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, 
analysis.button_exec_id))
-
-        # Wait for execution to complete.
-        analysis.thread.join()
-
-        # Exceptions in the thread.
-        self.check_exceptions()
-
-        # The real data.
-        res_nums = [4, 5, 6]
-        sat = [5050.0, 51643.0, 53663.0]
-        ref = [148614.0, 166842.0, 128690.0]
-        noe = [0.033980647852826784, 0.30953237194471417, 0.4169943274535706]
-        noe_err = [0.02020329903276632, 0.019181416098790607, 
0.026067523940084526]
-
-        # Check the data pipe.
-        self.assertEqual(cdp_name(), ds.relax_gui.analyses[0].pipe_name)
-
-        # Check the data.
-        i = 0
-        for spin_cont, mol_name, res_num, res_name in 
spin_loop(full_info=True):
-            # Skip deselected spins.
-            if not spin_cont.select:
-                continue
-
-            # Spin info.
-            self.assertEqual(res_nums[i], res_num)
-
-            # Check the intensity data.
-            self.assertEqual(sat[i], spin_cont.intensities['sat'])
-            self.assertEqual(ref[i], spin_cont.intensities['ref'])
-
-            # Check the NOE data.
-            self.assertEqual(noe[i], spin_cont.noe)
-            self.assertEqual(noe_err[i], spin_cont.noe_err)
-
-            # Increment the spin index.
-            i += 1
-
-        # Check the created files.
-        self.assert_(access(ds.tmpdir+sep+'grace'+sep+'noe.agr', F_OK))
+        # Test the relax data store.
+        self.assert_(hasattr(ds, 'relax_gui'))
+        self.assertEqual(ds.relax_gui.analyses[index].analysis_name, 
'Model-free')
+        self.assertEqual(ds.relax_gui.analyses[index].pipe_name, 'a')




Related Messages


Powered by MHonArc, Updated Wed Jul 20 15:40:02 2011