def test_pna_single_point_view2(windows, root_view, task_workbench): """Test PNA single point meas view. """ task = PNASinglePointMeasureTask(name='Test') task.measures = [('S21', ''), ('S43', 'MLIN')] root_view.task.add_child_task(0, task) show_and_close_widget(PNASinglePointView(task=task, root=root_view))
def setup(self): self.root = RootTask(should_stop=Event(), should_pause=Event()) self.task = PNASinglePointMeasureTask(name='Test') self.root.add_child_task(0, self.task) self.root.run_time[DRIVERS] = {'Test': (InstrHelper, InstrHelperStarter())} self.root.run_time[PROFILES] =\ {'Test1': {'connections': {'C': {'owner': []}}, 'settings': {'S': {'check_connection': [True]}} } } # This is set simply to make sure the test of InstrTask pass. self.task.selected_instrument = ('Test1', 'Test', 'C', 'S')
class TestPNASinglePointMeasureTask(object): """Test PNASinglePointMeasureTask. """ def setup(self): self.root = RootTask(should_stop=Event(), should_pause=Event()) self.task = PNASinglePointMeasureTask(name='Test') self.root.add_child_task(0, self.task) self.root.run_time[DRIVERS] = {'Test': (InstrHelper, InstrHelperStarter())} self.root.run_time[PROFILES] =\ {'Test1': {'connections': {'C': {'owner': []}}, 'settings': {'S': {'check_connection': [True]}} } } # This is set simply to make sure the test of InstrTask pass. self.task.selected_instrument = ('Test1', 'Test', 'C', 'S') def test_measure_observation(self): pass def test_check1(self): """Simply test that everything is ok. """ self.task.measures = [('S21', ''), ('S33', 'MLIN')] c = self.root.run_time[PROFILES]['Test1']['connections'] c['C'] = {'defined_channels': [[1]]} test, traceback = self.task.check(test_instr=True) assert test assert not traceback def test_check2(self): """Check handling a wrong channel. """ self.task.measures = [('S21', ''), ('S33', 'MLIN')] c = self.root.run_time[PROFILES]['Test1']['connections'] c['C'] = {'defined_channels': [[3]]} test, traceback = self.task.check(test_instr=True) assert not test assert len(traceback) == 1 def test_check3(self): """Check handling a wrong S parameter. """ self.task.measures = [('S21', ''), ('SF3', 'MLIN')] c = self.root.run_time[PROFILES]['Test1']['connections'] c['C'] = {'defined_channels': [[1]]} test, traceback = self.task.check(test_instr=True) assert not test assert len(traceback) == 1