1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from os import F_OK, access, sep
24 import wx
25
26
27 from data import Relax_data_store; ds = Relax_data_store()
28 from generic_fns.mol_res_spin import spin_loop
29 from generic_fns.pipes import cdp_name
30 from status import Status; status = Status()
31 from test_suite.gui_tests.base_classes import GuiTestCase
32
33
34 from gui.string_conv import int_to_gui, str_to_gui
35 from gui.wizard import Wiz_window
36
37
39 """Class for testing various aspects specific to saved states."""
40
41 - def __init__(self, methodName='runTest'):
42 """Skip certain tests due to wxPython bugs.
43
44 @keyword methodName: The name of the test.
45 @type methodName: str
46 """
47
48
49 super(State, self).__init__(methodName)
50
51
52 skip = ['test_load_state_no_gui']
53 if wx.version() == '2.9.4.1 gtk2 (classic)' and methodName in skip:
54
55 status.skipped_tests.append([methodName, 'wxPython 2.9.4.1 gtk2 bugs', self._skip_type])
56
57
59 """Catch U{bug #20480<https://web.archive.org/web/https://gna.org/bugs/?20480>}, the failure to load a relax state in the GUI.
60
61 This was reported by U{Stanislava Panova<https://web.archive.org/web/https://gna.org/users/stacy>}.
62 """
63
64
65 file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'saved_states' + sep + 'bug_20480.bz2'
66 self.app.gui.state_load(file_name=file)
67
68
69 self.assertEqual(cdp_name(), "aic - mf (Mon Feb 4 13:30:01 2013)")
70 self.assertEqual(cdp.frq['NOE_800'], 800000031.0)
71 self.assertEqual(cdp.frq['R1_800'], 800000031.0)
72 self.assertEqual(cdp.frq['R2_800'], 800000031.0)
73 self.assertEqual(cdp.frq['R2_600'], 599999000.0)
74
75
77 """Test the loading of an old relax 1.3 save state with GUI information."""
78
79
80 file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'saved_states' + sep + 'gui_analyses_1.3.bz2'
81 self.app.gui.state_load(file_name=file)
82
83
84 names = ['Steady-state NOE', 'R1 relaxation', 'Model-free']
85 types = ['NOE', 'R1', 'model-free']
86 frq = ['600', '300', None]
87 grid_inc = [None, None, 3]
88 mc_sim_num = [None, None, 50]
89 pipe_names = ['noe (Wed May 30 20:33:21 2012)', 'r1 (Wed May 30 20:55:02 2012)', 'mf (Wed May 30 21:23:17 2012)']
90 save_dirs = ['/data/relax/gui/gui_testing/noe', '/data/relax/gui/gui_testing/r1', '/data/relax/gui/gui_testing/mf']
91 for i in range(len(ds.relax_gui.analyses)):
92 self.assertEqual(ds.relax_gui.analyses[i].analysis_name, names[i])
93 self.assertEqual(ds.relax_gui.analyses[i].analysis_type, types[i])
94 self.assertEqual(ds.relax_gui.analyses[i].pipe_name, pipe_names[i])
95 self.assertEqual(ds.relax_gui.analyses[i].save_dir, save_dirs[i])
96 if frq[i] != None:
97 self.assertEqual(ds.relax_gui.analyses[i].frq, frq[i])
98 if grid_inc[i] != None:
99 self.assertEqual(ds.relax_gui.analyses[i].grid_inc, grid_inc[i])
100 if mc_sim_num[i] != None:
101 self.assertEqual(ds.relax_gui.analyses[i].mc_sim_num, mc_sim_num[i])
102
103
104 self.assertEqual(len(ds), 9)
105 pipe_names = ["noe (Wed May 30 20:33:21 2012)", "r1 (Wed May 30 20:55:02 2012)", "mf (Wed May 30 21:23:17 2012)", "local_tm", "sphere", "oblate", "prolate", "ellipsoid", "final"]
106 for pipe in pipe_names:
107
108 for i in range(len(ds[pipe].mol[0].res)):
109
110 res = ds[pipe].mol[0].res[i]
111
112
113 self.assertEqual(res.spin[0].name, 'N')
114
115
116 if pipe in ["noe (Wed May 30 20:33:21 2012)", "r1 (Wed May 30 20:55:02 2012)"]:
117 continue
118
119
120 self.assertEqual(res.spin[1].name, 'H')
121
122
124 """Test the loading of a relax save state with no GUI data."""
125
126
127 file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'model_free' + sep + 'OMP' + sep + 'final_results_trunc_1.3_v2'
128 self.app.gui.state_load(file_name=file)
129
130
131 self._execute_uf(uf_name='pipe.bundle', pipe='a', bundle='test bundle')
132
133
134 self.app.gui.show_pipe_editor(None)
135
136
137 self.app.gui.pipe_editor.menu(Fake_grid_cell_right_click())
138
139
140 self.app.gui.pipe_editor.associate_auto(None)
141
142
143 index = 0
144
145
146 self.assert_(not self.app.gui.analysis.init_state)
147 self.assertEqual(self.app.gui.analysis._num_analyses, 1)
148 self.assertEqual(len(self.app.gui.analysis._analyses), 1)
149 self.assertEqual(self.app.gui.analysis.notebook.GetPageCount(), 1)
150 self.assert_(self.app.gui.analysis._analyses[index].init_flag)
151
152
153 self.assert_(hasattr(ds, 'relax_gui'))
154 self.assertEqual(ds.relax_gui.analyses[index].analysis_name, 'Model-free')
155 self.assertEqual(ds.relax_gui.analyses[index].pipe_name, 'a')
156
157
158
160 """Simulate a grid_cell_right_click event ."""
161
163 """Overwrite the GetRow() method."""
164
165
166 return 0
167