Ejemplo n.º 1
0
    def test_get_config_list_corrupt_2(self):
        class TestALH:
            def get(self, resource):
                return b"dev #0, Test, 2 configs:"

        alh = TestALH()
        s = signalgenerator.SignalGenerator(alh)

        self.assertRaises(CRCError, s.get_config_list)
Ejemplo n.º 2
0
    def test_get_config_list_corrupt_3(self):
        class TestALH:
            def get(self, resource):
                s = "dev #0, Test, 1 configs:\n"\
                 "  cfg #0: Test:"
                return s.encode('ascii')

        alh = TestALH()
        s = signalgenerator.SignalGenerator(alh)

        self.assertRaises(CRCError, s.get_config_list)
Ejemplo n.º 3
0
    def test_get_config_list_corrupt_1(self):
        class TestALH:
            def get(self, resource):
                return b""

        alh = TestALH()
        s = signalgenerator.SignalGenerator(alh)

        cl = s.get_config_list()

        self.assertEqual(cl.configs, [])
        self.assertEqual(cl.devices, [])
Ejemplo n.º 4
0
    def test_get_config_list(self):
        class TestALH:
            def get(self, resource):
                s = "dev #0, Test, 1 configs:\n" \
                 "  cfg #0: Test:\n" \
                 "     base: 10 Hz, spacing: 1 Hz, bw: 1 Hz, channels: 10, min power: -10 dBm, max power: 0 dBm, time: 1 ms"
                return s.encode('ascii')

        alh = TestALH()
        s = signalgenerator.SignalGenerator(alh)

        cl = s.get_config_list()

        self.assertEqual(len(cl.devices), 1)
        self.assertEqual(len(cl.configs), 1)