def test_check_linspace_interface1(self): # Simply test that everything is ok when all formulas are true. interface = LinspaceLoopInterface() interface.start = '1.0' interface.stop = '2.0' interface.step = '0.1' self.task.interface = interface test, traceback = self.task.check() assert_true(test) assert_false(traceback) assert_equal(self.task.get_from_database('Test_point_number'), 11)
def test_check_linspace_interface2(self): # Test handling a wrong start. interface = LinspaceLoopInterface() interface.start = '1.0*' interface.stop = '2.0' interface.step = '0.1' self.task.interface = interface test, traceback = self.task.check(test_instr=True) assert_false(test) assert_equal(len(traceback), 1) assert_in('root/Test-start', traceback)
def test_perform2(self): # Test performing a simple loop no timing. Linspace interface. interface = LinspaceLoopInterface() interface.start = '1.0' interface.stop = '2.0' interface.step = '0.1' self.task.interface = interface self.root.task_database.prepare_for_running() self.task.perform() assert_equal(self.root.get_from_database('Test_value'), 2.0)
def test_check_linspace_interface5(self): # Test handling a wrong number of point. interface = LinspaceLoopInterface() interface.start = '1.0' interface.stop = '2.0' interface.step = '0.0' self.task.interface = interface test, traceback = self.task.check(test_instr=True) assert_false(test) assert_equal(len(traceback), 2) assert_in('root/Test-points', traceback) assert_in('root/Test-linspace', traceback)
def test_view2(self): # Intantiate a view with a selected interface. interface = LinspaceLoopInterface() self.task.interface = interface window = enaml.widgets.api.Window() core = self.workbench.get_plugin('enaml.workbench.core') LoopView(window, task=self.task, core=core) window.show() process_app_events() assert_is(self.task.interface, interface)