示例#1
0
    def setup(self):
        self.root = RootTask(should_stop=Event(), should_pause=Event())
        self.task = PNASinglePointMeasureTask(task_name='Test')
        self.root.children_task.append(self.task)
        self.root.run_time['drivers'] = {'Test': InstrHelper}

        # This is set simply to make sure the test of InstrTask pass.
        self.task.selected_driver = 'Test'
        self.task.selected_profile = 'Test1'
class TestPNASinglePointMeasureTask(object):

    def setup(self):
        self.root = RootTask(should_stop=Event(), should_pause=Event())
        self.task = PNASinglePointMeasureTask(task_name='Test')
        self.root.children_task.append(self.task)
        self.root.run_time['drivers'] = {'Test': InstrHelper}

        # This is set simply to make sure the test of InstrTask pass.
        self.task.selected_driver = 'Test'
        self.task.selected_profile = 'Test1'

    def test_measure_observation(self):
        pass

    def test_check1(self):
        # Simply test that everything is ok.
        self.task.measures = [('S21', ''), ('S33', 'MLIN')]

        profile = {'Test1': ({'defined_channels': [[1]]},
                             {})}
        self.root.run_time['profiles'] = profile

        test, traceback = self.task.check(test_instr=True)
        assert_true(test)
        assert_false(traceback)

    def test_check2(self):
        # Check handling a wrong channel.
        self.task.measures = [('S21', ''), ('S33', 'MLIN')]

        profile = {'Test1': ({'defined_channels': [[3]]},
                             {})}
        self.root.run_time['profiles'] = profile

        test, traceback = self.task.check(test_instr=True)
        assert_false(test)
        assert_equal(len(traceback), 1)

    def test_check3(self):
        # Check handling a wrong S parameter.
        self.task.measures = [('S21', ''), ('SF3', 'MLIN')]

        profile = {'Test1': ({'defined_channels': [[1]]},
                             {})}
        self.root.run_time['profiles'] = profile

        test, traceback = self.task.check(test_instr=True)
        assert_false(test)
        assert_equal(len(traceback), 1)
示例#3
0
class TestPNASinglePointMeasureTask(object):
    def setup(self):
        self.root = RootTask(should_stop=Event(), should_pause=Event())
        self.task = PNASinglePointMeasureTask(task_name='Test')
        self.root.children_task.append(self.task)
        self.root.run_time['drivers'] = {'Test': InstrHelper}

        # This is set simply to make sure the test of InstrTask pass.
        self.task.selected_driver = 'Test'
        self.task.selected_profile = 'Test1'

    def test_measure_observation(self):
        pass

    def test_check1(self):
        # Simply test that everything is ok.
        self.task.measures = [('S21', ''), ('S33', 'MLIN')]

        profile = {'Test1': ({'defined_channels': [[1]]}, {})}
        self.root.run_time['profiles'] = profile

        test, traceback = self.task.check(test_instr=True)
        assert_true(test)
        assert_false(traceback)

    def test_check2(self):
        # Check handling a wrong channel.
        self.task.measures = [('S21', ''), ('S33', 'MLIN')]

        profile = {'Test1': ({'defined_channels': [[3]]}, {})}
        self.root.run_time['profiles'] = profile

        test, traceback = self.task.check(test_instr=True)
        assert_false(test)
        assert_equal(len(traceback), 1)

    def test_check3(self):
        # Check handling a wrong S parameter.
        self.task.measures = [('S21', ''), ('SF3', 'MLIN')]

        profile = {'Test1': ({'defined_channels': [[1]]}, {})}
        self.root.run_time['profiles'] = profile

        test, traceback = self.task.check(test_instr=True)
        assert_false(test)
        assert_equal(len(traceback), 1)
    def setup(self):
        self.root = RootTask(should_stop=Event(), should_pause=Event())
        self.task = PNASinglePointMeasureTask(task_name='Test')
        self.root.children_task.append(self.task)
        self.root.run_time['drivers'] = {'Test': InstrHelper}

        # This is set simply to make sure the test of InstrTask pass.
        self.task.selected_driver = 'Test'
        self.task.selected_profile = 'Test1'