"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test_suite/gui_tests/test_user_functions.py" between
relax-4.1.3.src.tar.bz2 and relax-5.0.0.src.tar.bz2

About: relax allows the study of molecular dynamics through the analysis of experimental NMR data. Organic molecules, proteins, RNA, DNA, sugars, and other biomolecules are all supported.

test_user_functions.py  (relax-4.1.3.src.tar.bz2):test_user_functions.py  (relax-5.0.0.src.tar.bz2)
skipping to change at line 29 skipping to change at line 29
# # # #
############################################################################### ###############################################################################
"""Module for testing the special features of the user function GUI windows.""" """Module for testing the special features of the user function GUI windows."""
# Python module imports. # Python module imports.
from os import path, sep from os import path, sep
import sys import sys
# relax module imports. # relax module imports.
import dep_check
from status import Status; status = Status() from status import Status; status = Status()
from test_suite.gui_tests.base_classes import GuiTestCase from test_suite.gui_tests.base_classes import GuiTestCase
# relax GUI imports. # relax GUI imports.
from gui.interpreter import Interpreter; interpreter = Interpreter() from gui.interpreter import Interpreter; interpreter = Interpreter()
from gui.string_conv import float_to_gui, int_to_gui, str_to_gui from gui.string_conv import float_to_gui, int_to_gui, str_to_gui
from gui.uf_objects import Uf_storage; uf_store = Uf_storage() from gui.uf_objects import Uf_storage; uf_store = Uf_storage()
class User_functions(GuiTestCase): class User_functions(GuiTestCase):
"""Class for testing special features of the user function GUI windows.""" """Class for testing special features of the user function GUI windows."""
skipping to change at line 131 skipping to change at line 132
def test_dx_map(self): def test_dx_map(self):
"""Test the operation of the dx.map user function GUI window.""" """Test the operation of the dx.map user function GUI window."""
# Open the dx.map user function window. # Open the dx.map user function window.
uf = uf_store['dx.map'] uf = uf_store['dx.map']
uf._sync = True uf._sync = True
uf.create_wizard(parent=self.app.gui) uf.create_wizard(parent=self.app.gui)
# Set the y-value of a single point, and check. # Set the y-value of a single point, and check.
uf.page.uf_args['point'].selection_win_show() uf.page.uf_args['point'].selection_win_show()
uf.page.uf_args['point'].sel_win.sequence.SetStringItem(0, 2, int_to_gui if dep_check.wx_classic:
(2)) uf.page.uf_args['point'].sel_win.sequence.SetStringItem(0, 2, int_to
_gui(2))
else:
uf.page.uf_args['point'].sel_win.sequence.SetItem(0, 2, int_to_gui(2
))
uf.page.uf_args['point'].selection_win_data() uf.page.uf_args['point'].selection_win_data()
points = uf.page.uf_args['point'].GetValue() points = uf.page.uf_args['point'].GetValue()
print("Points: %s" % points) print("Points: %s" % points)
self.assertEqual(len(points), 1) self.assertEqual(len(points), 1)
self.assertEqual(len(points[0]), 3) self.assertEqual(len(points[0]), 3)
self.assertEqual(points[0][0], None) self.assertEqual(points[0][0], None)
self.assertEqual(points[0][1], 2.0) self.assertEqual(points[0][1], 2.0)
self.assertEqual(points[0][2], None) self.assertEqual(points[0][2], None)
# Set the point to nothing in the wizard, open the Sequence_2D window, c lose the window, and check that None comes back. # Set the point to nothing in the wizard, open the Sequence_2D window, c lose the window, and check that None comes back.
skipping to change at line 194 skipping to change at line 198
uf.page.uf_args['point'].selection_win_show() uf.page.uf_args['point'].selection_win_show()
uf.page.uf_args['point'].selection_win_data() uf.page.uf_args['point'].selection_win_data()
points = uf.page.uf_args['point'].GetValue() points = uf.page.uf_args['point'].GetValue()
print("Points: %s" % points) print("Points: %s" % points)
self.assertEqual(points, None) self.assertEqual(points, None)
# Set the Sequence_2D elements to invalid values. # Set the Sequence_2D elements to invalid values.
for val in ['x']: for val in ['x']:
uf.page.uf_args['point'].SetValue(str_to_gui('')) uf.page.uf_args['point'].SetValue(str_to_gui(''))
uf.page.uf_args['point'].selection_win_show() uf.page.uf_args['point'].selection_win_show()
uf.page.uf_args['point'].sel_win.sequence.SetStringItem(0, 2, str_to if dep_check.wx_classic:
_gui(val)) uf.page.uf_args['point'].sel_win.sequence.SetStringItem(0, 2, st
uf.page.uf_args['point'].sel_win.sequence.SetStringItem(0, 1, int_to r_to_gui(val))
_gui(1)) uf.page.uf_args['point'].sel_win.sequence.SetStringItem(0, 1, in
t_to_gui(1))
else:
uf.page.uf_args['point'].sel_win.sequence.SetItem(0, 2, str_to_g
ui(val))
uf.page.uf_args['point'].sel_win.sequence.SetItem(0, 1, int_to_g
ui(1))
uf.page.uf_args['point'].selection_win_data() uf.page.uf_args['point'].selection_win_data()
points = uf.page.uf_args['point'].GetValue() points = uf.page.uf_args['point'].GetValue()
print("Points: %s" % points) print("Points: %s" % points)
self.assertEqual(len(points), 1) self.assertEqual(len(points), 1)
self.assertEqual(len(points[0]), 3) self.assertEqual(len(points[0]), 3)
self.assertEqual(points[0][0], 1.0) self.assertEqual(points[0][0], 1.0)
self.assertEqual(points[0][1], None) self.assertEqual(points[0][1], None)
self.assertEqual(points[0][2], None) self.assertEqual(points[0][2], None)
def test_spectrum_read_intensities(self): def test_spectrum_read_intensities(self):
skipping to change at line 261 skipping to change at line 269
def test_structure_add_atom(self): def test_structure_add_atom(self):
"""Test the operation of the structure.add_atom user function GUI window .""" """Test the operation of the structure.add_atom user function GUI window ."""
# Open the structure.add_atom user function window. # Open the structure.add_atom user function window.
uf = uf_store['structure.add_atom'] uf = uf_store['structure.add_atom']
uf._sync = True uf._sync = True
uf.create_wizard(parent=self.app.gui) uf.create_wizard(parent=self.app.gui)
# Set the y-value of a single pos, and check. # Set the y-value of a single pos, and check.
#uf.page.uf_args['pos'].selection_win_show() #uf.page.uf_args['pos'].selection_win_show()
#uf.page.uf_args['pos'].sel_win.sequence.SetStringItem(1, 1, int_to_gui( #if dep_check.wx_classic:
2)) # uf.page.uf_args['pos'].sel_win.sequence.SetStringItem(1, 1, int_to_
gui(2))
#else:
# uf.page.uf_args['pos'].sel_win.sequence.SetItem(1, 1, int_to_gui(2)
)
#uf.page.uf_args['pos'].selection_win_data() #uf.page.uf_args['pos'].selection_win_data()
#pos = uf.page.uf_args['pos'].GetValue() #pos = uf.page.uf_args['pos'].GetValue()
#print("Pos: %s" % pos) #print("Pos: %s" % pos)
#self.assertEqual(len(pos), 3) #self.assertEqual(len(pos), 3)
#self.assertEqual(pos[0], None) #self.assertEqual(pos[0], None)
#self.assertEqual(pos[1], 2.0) #self.assertEqual(pos[1], 2.0)
#self.assertEqual(pos[2], None) #self.assertEqual(pos[2], None)
# Set the pos to nothing in the wizard, open the Sequence window, close the window, and check that None comes back. # Set the pos to nothing in the wizard, open the Sequence window, close the window, and check that None comes back.
val = '' val = ''
skipping to change at line 312 skipping to change at line 323
pos = uf.page.uf_args['pos'].GetValue() pos = uf.page.uf_args['pos'].GetValue()
sys.stdout.write("Return: %40s\n" % repr(pos)) sys.stdout.write("Return: %40s\n" % repr(pos))
self.assertEqual(pos, None) self.assertEqual(pos, None)
# Set the Sequence elements to invalid values. # Set the Sequence elements to invalid values.
for val in ['x']: for val in ['x']:
sys.stdout.write("Value: %40s; " % repr(val)) sys.stdout.write("Value: %40s; " % repr(val))
uf.page.uf_args['pos'].SetValue(str_to_gui('')) uf.page.uf_args['pos'].SetValue(str_to_gui(''))
uf.page.uf_args['pos'].selection_win_show() uf.page.uf_args['pos'].selection_win_show()
uf.page.uf_args['pos'].sel_win.add_element() uf.page.uf_args['pos'].sel_win.add_element()
uf.page.uf_args['pos'].sel_win.sequence.SetStringItem(1, 1, str_to_g if dep_check.wx_classic:
ui(val)) uf.page.uf_args['pos'].sel_win.sequence.SetStringItem(1, 1, str_
uf.page.uf_args['pos'].sel_win.sequence.SetStringItem(0, 1, int_to_g to_gui(val))
ui(1)) uf.page.uf_args['pos'].sel_win.sequence.SetStringItem(0, 1, int_
to_gui(1))
else:
uf.page.uf_args['pos'].sel_win.sequence.SetItem(1, 1, str_to_gui
(val))
uf.page.uf_args['pos'].sel_win.sequence.SetItem(0, 1, int_to_gui
(1))
uf.page.uf_args['pos'].selection_win_data() uf.page.uf_args['pos'].selection_win_data()
pos = uf.page.uf_args['pos'].GetValue() pos = uf.page.uf_args['pos'].GetValue()
sys.stdout.write("Return: %40s\n" % repr(pos)) sys.stdout.write("Return: %40s\n" % repr(pos))
#self.assertEqual(len(pos), 1) #self.assertEqual(len(pos), 1)
self.assertEqual(pos[0][0], 1.0) self.assertEqual(pos[0][0], 1.0)
#self.assertEqual(pos[0][1], None) #self.assertEqual(pos[0][1], None)
#self.assertEqual(pos[0][2], None) #self.assertEqual(pos[0][2], None)
def test_structure_pdb_read(self): def test_structure_pdb_read(self):
"""Test the full operation of the structure.read_pdb user function GUI w indow.""" """Test the full operation of the structure.read_pdb user function GUI w indow."""
skipping to change at line 341 skipping to change at line 356
uf.create_wizard(parent=self.app.gui) uf.create_wizard(parent=self.app.gui)
# The PDB file to operate on. # The PDB file to operate on.
file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'structures' + sep + 'trunc_ubi_pcs.pdb' file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'structures' + sep + 'trunc_ubi_pcs.pdb'
uf.page.SetValue('file', str_to_gui(file)) uf.page.SetValue('file', str_to_gui(file))
# Set the models to read. # Set the models to read.
uf.page.SetValue('read_model', str_to_gui('6')) uf.page.SetValue('read_model', str_to_gui('6'))
uf.page.uf_args['read_model'].selection_win_show() uf.page.uf_args['read_model'].selection_win_show()
uf.page.uf_args['read_model'].sel_win.add_element(None) uf.page.uf_args['read_model'].sel_win.add_element(None)
uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(0, 1, int_t if dep_check.wx_classic:
o_gui(2)) uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(0, 1, i
uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(1, 1, int_t nt_to_gui(2))
o_gui(4)) uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(1, 1, i
nt_to_gui(4))
else:
uf.page.uf_args['read_model'].sel_win.sequence.SetItem(0, 1, int_to_
gui(2))
uf.page.uf_args['read_model'].sel_win.sequence.SetItem(1, 1, int_to_
gui(4))
uf.page.uf_args['read_model'].selection_win_data() uf.page.uf_args['read_model'].selection_win_data()
# Renumber the models. # Renumber the models.
uf.page.uf_args['set_model_num'].selection_win_show() uf.page.uf_args['set_model_num'].selection_win_show()
uf.page.uf_args['set_model_num'].sel_win.add_element(None) uf.page.uf_args['set_model_num'].sel_win.add_element(None)
uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(0, 1, in if dep_check.wx_classic:
t_to_gui(1)) uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(0, 1
uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(1, 1, in , int_to_gui(1))
t_to_gui(3)) uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(1, 1
, int_to_gui(3))
else:
uf.page.uf_args['set_model_num'].sel_win.sequence.SetItem(0, 1, int_
to_gui(1))
uf.page.uf_args['set_model_num'].sel_win.sequence.SetItem(1, 1, int_
to_gui(3))
uf.page.uf_args['set_model_num'].selection_win_data() uf.page.uf_args['set_model_num'].selection_win_data()
# GUI data checks. # GUI data checks.
self.assertEqual(uf.page.uf_args['read_model'].GetValue(), [2, 4]) self.assertEqual(uf.page.uf_args['read_model'].GetValue(), [2, 4])
self.assertEqual(uf.page.uf_args['set_model_num'].GetValue(), [1, 3]) self.assertEqual(uf.page.uf_args['set_model_num'].GetValue(), [1, 3])
# Execute the user function. # Execute the user function.
uf.wizard._go_next(None) uf.wizard._go_next(None)
# Check the structural data. # Check the structural data.
skipping to change at line 385 skipping to change at line 408
uf.create_wizard(parent=self.app.gui) uf.create_wizard(parent=self.app.gui)
# The PDB file to operate on. # The PDB file to operate on.
file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'structures' + sep + 'trunc_ubi_pcs.pdb' file = status.install_path + sep + 'test_suite' + sep + 'shared_data' + sep + 'structures' + sep + 'trunc_ubi_pcs.pdb'
uf.page.SetValue('file', str_to_gui(file)) uf.page.SetValue('file', str_to_gui(file))
# Set the models to read. # Set the models to read.
uf.page.SetValue('read_model', str_to_gui('6')) uf.page.SetValue('read_model', str_to_gui('6'))
uf.page.uf_args['read_model'].selection_win_show() uf.page.uf_args['read_model'].selection_win_show()
uf.page.uf_args['read_model'].sel_win.add_element(None) uf.page.uf_args['read_model'].sel_win.add_element(None)
uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(0, 1, int_t if dep_check.wx_classic:
o_gui(2)) uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(0, 1, i
uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(1, 1, int_t nt_to_gui(2))
o_gui(4)) uf.page.uf_args['read_model'].sel_win.sequence.SetStringItem(1, 1, i
nt_to_gui(4))
else:
uf.page.uf_args['read_model'].sel_win.sequence.SetItem(0, 1, int_to_
gui(2))
uf.page.uf_args['read_model'].sel_win.sequence.SetItem(1, 1, int_to_
gui(4))
uf.page.uf_args['read_model'].selection_win_data() uf.page.uf_args['read_model'].selection_win_data()
# Renumber the models. # Renumber the models.
uf.page.uf_args['set_model_num'].selection_win_show() uf.page.uf_args['set_model_num'].selection_win_show()
uf.page.uf_args['set_model_num'].sel_win.add_element(None) uf.page.uf_args['set_model_num'].sel_win.add_element(None)
uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(0, 1, in if dep_check.wx_classic:
t_to_gui(1)) uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(0, 1
uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(1, 1, in , int_to_gui(1))
t_to_gui(3)) uf.page.uf_args['set_model_num'].sel_win.sequence.SetStringItem(1, 1
, int_to_gui(3))
else:
uf.page.uf_args['set_model_num'].sel_win.sequence.SetItem(0, 1, int_
to_gui(1))
uf.page.uf_args['set_model_num'].sel_win.sequence.SetItem(1, 1, int_
to_gui(3))
uf.page.uf_args['set_model_num'].selection_win_data() uf.page.uf_args['set_model_num'].selection_win_data()
# GUI data checks. # GUI data checks.
self.assertEqual(uf.page.uf_args['read_model'].GetValue(), [2, 4]) self.assertEqual(uf.page.uf_args['read_model'].GetValue(), [2, 4])
self.assertEqual(uf.page.uf_args['set_model_num'].GetValue(), [1, 3]) self.assertEqual(uf.page.uf_args['set_model_num'].GetValue(), [1, 3])
# Execute the user function. # Execute the user function.
uf.wizard._go_next(None) uf.wizard._go_next(None)
# Open the structure.rotate user function window. # Open the structure.rotate user function window.
uf = uf_store['structure.rotate'] uf = uf_store['structure.rotate']
uf._sync = True uf._sync = True
uf.create_wizard(parent=self.app.gui) uf.create_wizard(parent=self.app.gui)
# Change the rotation matrix in the Sequence_2D window, without changing anything, then check it. # Change the rotation matrix in the Sequence_2D window, without changing anything, then check it.
uf.page.uf_args['R'].selection_win_show() uf.page.uf_args['R'].selection_win_show()
uf.page.uf_args['R'].sel_win.sequence.SetStringItem(1, 1, int_to_gui(2)) if dep_check.wx_classic:
uf.page.uf_args['R'].sel_win.sequence.SetStringItem(1, 1, int_to_gui
(2))
else:
uf.page.uf_args['R'].sel_win.sequence.SetItem(1, 1, int_to_gui(2))
uf.page.uf_args['R'].selection_win_data() uf.page.uf_args['R'].selection_win_data()
R = uf.page.uf_args['R'].GetValue() R = uf.page.uf_args['R'].GetValue()
print("Rotation matrix:\n%s" % R) print("Rotation matrix:\n%s" % R)
self.assertEqual(len(R), 3) self.assertEqual(len(R), 3)
self.assertEqual(len(R[0]), 3) self.assertEqual(len(R[0]), 3)
self.assertEqual(R[0][0], 1) self.assertEqual(R[0][0], 1)
self.assertEqual(R[0][1], 0) self.assertEqual(R[0][1], 0)
self.assertEqual(R[0][2], 0) self.assertEqual(R[0][2], 0)
self.assertEqual(R[1][0], 0) self.assertEqual(R[1][0], 0)
self.assertEqual(R[1][1], 2) self.assertEqual(R[1][1], 2)
self.assertEqual(R[1][2], 0) self.assertEqual(R[1][2], 0)
self.assertEqual(R[2][0], 0) self.assertEqual(R[2][0], 0)
self.assertEqual(R[2][1], 0) self.assertEqual(R[2][1], 0)
self.assertEqual(R[2][2], 1) self.assertEqual(R[2][2], 1)
# Set the rotation matrix to nothing in the wizard, open the Sequence_2D window, set a value, close the window, and check what happens. # Set the rotation matrix to nothing in the wizard, open the Sequence_2D window, set a value, close the window, and check what happens.
uf.page.uf_args['R'].SetValue(str_to_gui('')) uf.page.uf_args['R'].SetValue(str_to_gui(''))
uf.page.uf_args['R'].selection_win_show() uf.page.uf_args['R'].selection_win_show()
uf.page.uf_args['R'].sel_win.sequence.SetStringItem(1, 1, int_to_gui(2)) if dep_check.wx_classic:
uf.page.uf_args['R'].sel_win.sequence.SetStringItem(1, 1, int_to_gui
(2))
else:
uf.page.uf_args['R'].sel_win.sequence.SetItem(1, 1, int_to_gui(2))
uf.page.uf_args['R'].selection_win_data() uf.page.uf_args['R'].selection_win_data()
R = uf.page.uf_args['R'].GetValue() R = uf.page.uf_args['R'].GetValue()
print("Rotation matrix:\n%s" % R) print("Rotation matrix:\n%s" % R)
self.assertEqual(len(R), 3) self.assertEqual(len(R), 3)
self.assertEqual(len(R[0]), 3) self.assertEqual(len(R[0]), 3)
self.assertEqual(R[0][0], None) self.assertEqual(R[0][0], None)
self.assertEqual(R[0][1], None) self.assertEqual(R[0][1], None)
self.assertEqual(R[0][2], None) self.assertEqual(R[0][2], None)
self.assertEqual(R[1][0], None) self.assertEqual(R[1][0], None)
self.assertEqual(R[1][1], 2) self.assertEqual(R[1][1], 2)
skipping to change at line 466 skipping to change at line 503
uf.page.uf_args['R'].selection_win_show() uf.page.uf_args['R'].selection_win_show()
uf.page.uf_args['R'].selection_win_data() uf.page.uf_args['R'].selection_win_data()
R = uf.page.uf_args['R'].GetValue() R = uf.page.uf_args['R'].GetValue()
print("Rotation matrix:\n%s" % R) print("Rotation matrix:\n%s" % R)
self.assertEqual(R, None) self.assertEqual(R, None)
# Set the Sequence_2D elements to invalid values. # Set the Sequence_2D elements to invalid values.
for val in ['x']: for val in ['x']:
uf.page.uf_args['R'].SetValue(str_to_gui('')) uf.page.uf_args['R'].SetValue(str_to_gui(''))
uf.page.uf_args['R'].selection_win_show() uf.page.uf_args['R'].selection_win_show()
uf.page.uf_args['R'].sel_win.sequence.SetStringItem(1, 1, str_to_gui if dep_check.wx_classic:
(val)) uf.page.uf_args['R'].sel_win.sequence.SetStringItem(1, 1, str_to
uf.page.uf_args['R'].sel_win.sequence.SetStringItem(0, 0, int_to_gui _gui(val))
(1)) uf.page.uf_args['R'].sel_win.sequence.SetStringItem(0, 0, int_to
_gui(1))
else:
uf.page.uf_args['R'].sel_win.sequence.SetItem(1, 1, str_to_gui(v
al))
uf.page.uf_args['R'].sel_win.sequence.SetItem(0, 0, int_to_gui(1
))
uf.page.uf_args['R'].selection_win_data() uf.page.uf_args['R'].selection_win_data()
R = uf.page.uf_args['R'].GetValue() R = uf.page.uf_args['R'].GetValue()
print("Rotation matrix:\n%s" % R) print("Rotation matrix:\n%s" % R)
self.assertEqual(len(R), 3) self.assertEqual(len(R), 3)
self.assertEqual(len(R[0]), 3) self.assertEqual(len(R[0]), 3)
self.assertEqual(R[0][0], 1.0) self.assertEqual(R[0][0], 1.0)
self.assertEqual(R[0][1], None) self.assertEqual(R[0][1], None)
self.assertEqual(R[0][2], None) self.assertEqual(R[0][2], None)
self.assertEqual(R[1][0], None) self.assertEqual(R[1][0], None)
self.assertEqual(R[1][1], None) self.assertEqual(R[1][1], None)
 End of changes. 12 change blocks. 
34 lines changed or deleted 93 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)