Example #1
0
    def test_check_multichannel_interface3(self):
        # Check the multichannel specific tests, failing =profile.
        interface = MultiChannelVoltageSourceInterface(task=self.task)
        interface.channel = 1
        self.task.interface = interface
        self.task.target_value = '1.0'
        self.task.selected_profile = ''

        self.root.run_time['drivers'] = {'Test': InstrHelper}

        test, traceback = self.task.check()
        assert_false(test)
        assert_equal(len(traceback), 1)
    def test_check_multichannel_interface3(self):
        # Check the multichannel specific tests, failing =profile.
        interface = MultiChannelVoltageSourceInterface(task=self.task)
        interface.channel = 1
        self.task.interface = interface
        self.task.target_value = '1.0'
        self.task.selected_profile = ''

        self.root.run_time['drivers'] = {'Test': InstrHelper}

        test, traceback = self.task.check()
        assert_false(test)
        assert_equal(len(traceback), 1)
Example #3
0
    def test_check_multichannel_interface1(self):
        # Check the multichannel specific tests, passing.
        interface = MultiChannelVoltageSourceInterface(task=self.task)
        interface.channel = 1
        self.task.interface = interface
        self.task.target_value = '1.0'

        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_check_multichannel_interface1(self):
        # Check the multichannel specific tests, passing.
        interface = MultiChannelVoltageSourceInterface(task=self.task)
        interface.channel = 1
        self.task.interface = interface
        self.task.target_value = '1.0'

        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)
Example #5
0
    def test_check_multichannel_interface4(self):
        # Check the multichannel specific tests, failing = channel.
        interface = MultiChannelVoltageSourceInterface(task=self.task)
        interface.channel = 2
        self.task.interface = interface
        self.task.target_value = '1.0'

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

        test, traceback = self.task.check(test_instr=True)
        assert_false(test)
        assert_equal(len(traceback), 1)
    def test_check_multichannel_interface4(self):
        # Check the multichannel specific tests, failing = channel.
        interface = MultiChannelVoltageSourceInterface(task=self.task)
        interface.channel = 2
        self.task.interface = interface
        self.task.target_value = '1.0'

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

        test, traceback = self.task.check(test_instr=True)
        assert_false(test)
        assert_equal(len(traceback), 1)
    def test_perform_multichannel_interface(self):
        interface = MultiChannelVoltageSourceInterface(task=self.task)
        interface.channel = 1
        self.task.interface = interface
        self.task.target_value = '1.0'

        profile = {'Test1': ({'voltage': [0.0],
                              'funtion': ['VOLT'],
                              'owner': [None]},
                             {'get_channel': lambda x, i: x}
                             )}
        self.root.run_time['profiles'] = profile

        self.root.task_database.prepare_for_running()

        self.task.perform()
        assert_equal(self.root.get_from_database('Test_voltage'), 1.0)
Example #8
0
    def test_perform_multichannel_interface(self):
        interface = MultiChannelVoltageSourceInterface(task=self.task)
        interface.channel = 1
        self.task.interface = interface
        self.task.target_value = '1.0'

        profile = {
            'Test1': ({
                'voltage': [0.0],
                'funtion': ['VOLT'],
                'owner': [None]
            }, {
                'get_channel': lambda x, i: x
            })
        }
        self.root.run_time['profiles'] = profile

        self.root.task_database.prepare_for_running()

        self.task.perform()
        assert_equal(self.root.get_from_database('Test_voltage'), 1.0)
Example #9
0
    def test_view2(self):
        # Intantiate a view with a selected interface.
        interface = MultiChannelVoltageSourceInterface(task=self.task)
        self.task.interface = interface
        self.task.target_value = '1.0'
        self.task.selected_driver = 'TinyBilt'

        interface = self.task.interface

        window = enaml.widgets.api.Window()
        core = self.workbench.get_plugin('enaml.workbench.core')
        SetDcVoltageView(window, task=self.task, core=core)
        window.show()

        process_app_events()

        assert_is(self.task.interface, interface)