python类serial_for_url()的实例源码

test_advanced.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def setUp(self):
        # create a closed serial port
        self.s = serial.serial_for_url(PORT, do_not_open=True)
test_advanced.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_RtsCtsSetting(self):
        for rtscts in (True, False):
            self.s.rtscts = rtscts
            # test get method
            self.assertEqual(self.s.rtscts, rtscts)
            # test internals
            self.assertEqual(self.s._rtscts, rtscts)
        # no illegal values here, normal rules for the boolean value of an
        # object are used thus all objects have a truth value.

    # this test does not work anymore since serial_for_url that is used
    # now, already sets a port
test_iolib.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def setUp(self):
        self.s = serial.serial_for_url(PORT, timeout=1)
        #~ self.io = io.TextIOWrapper(self.s)
        self.io = io.TextIOWrapper(io.BufferedRWPair(self.s, self.s))
test_settings_dict.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_getsettings(self):
        """the settings dict reflects the current settings"""
        ser = serial.serial_for_url(PORT, do_not_open=True)
        d = ser.get_settings()
        for setting in SETTINGS:
            self.assertEqual(getattr(ser, setting), d[setting])
test_settings_dict.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_partial_settings(self):
        """partial settings dictionaries are also accepted"""
        ser = serial.serial_for_url(PORT, do_not_open=True)
        d = ser.get_settings()
        del d['baudrate']
        del d['bytesize']
        ser.apply_settings(d)
        for setting in d:
            self.assertEqual(getattr(ser, setting), d[setting])
test_cancel.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def setUp(self):
        # create a closed serial port
        self.s = serial.serial_for_url(PORT)
        self.assertTrue(hasattr(self.s, 'cancel_read'), "serial instance has no cancel_read")
        self.s.timeout = 10
        self.cancel_called = 0
test_cancel.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def setUp(self):
        # create a closed serial port
        self.s = serial.serial_for_url(PORT, baudrate=300)  # extra slow ~30B/s => 1kb ~ 34s
        self.assertTrue(hasattr(self.s, 'cancel_write'), "serial instance has no cancel_write")
        self.s.write_timeout = 10
        self.cancel_called = 0
test_rfc2217.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_failed_connection(self):
        # connection to closed port
        s = serial.serial_for_url('rfc2217://127.99.99.99:2217', do_not_open=True)
        self.assertRaises(serial.SerialException, s.open)
        self.assertFalse(s.is_open)
        s.close()  # no errors expected
        # invalid address
        s = serial.serial_for_url('rfc2217://127goingtofail', do_not_open=True)
        self.assertRaises(serial.SerialException, s.open)
        self.assertFalse(s.is_open)
        s.close()  # no errors expected
        # close w/o open is also OK
        s = serial.serial_for_url('rfc2217://irrelevant', do_not_open=True)
        self.assertFalse(s.is_open)
        s.close()  # no errors expected
test_high_load.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def setUp(self):
        self.s = serial.serial_for_url(PORT, BAUDRATE, timeout=10)
test_url.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_loop(self):
        """loop interface"""
        serial.serial_for_url('loop://', do_not_open=True)
test_url.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_bad_url(self):
        """invalid protocol specified"""
        self.assertRaises(ValueError, serial.serial_for_url, "imnotknown://")
test_url.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_custom_url(self):
        """custom protocol handlers"""
        # it's unknown
        self.assertRaises(ValueError, serial.serial_for_url, "test://")
        # add search path
        serial.protocol_handler_packages.append('handlers')
        # now it should work
        serial.serial_for_url("test://")
        # remove our handler again
        serial.protocol_handler_packages.remove('handlers')
        # so it should not work anymore
        self.assertRaises(ValueError, serial.serial_for_url, "test://")
test_rs485.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def setUp(self):
        # create a closed serial port
        self.s = serial.serial_for_url(PORT, do_not_open=True)
test_readline.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def setUp(self):
        self.s = serial.serial_for_url(PORT, timeout=1)
test.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def setUp(self):
        self.s = serial.serial_for_url(PORT, timeout=self.timeout)
test.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def setUp(self):
        self.s = serial.serial_for_url(PORT, timeout=None)
        self.event = SendEvent(self.s)
test.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def setUp(self):
        self.s = serial.serial_for_url(PORT, timeout=None)
test.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def setUp(self):
        self.s = serial.serial_for_url(PORT)
test_advanced.py 文件源码 项目:btc-fpga-miner 作者: marsohod4you 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def setUp(self):
        # create a closed serial port
        self.s = serial.serial_for_url(PORT, do_not_open=True)
test_advanced.py 文件源码 项目:btc-fpga-miner 作者: marsohod4you 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_RtsCtsSetting(self):
        for rtscts in (True, False):
            self.s.rtscts = rtscts
            # test get method
            self.failUnlessEqual(self.s.rtscts, rtscts)
            # test internals
            self.failUnlessEqual(self.s._rtscts, rtscts)
        # no illegal values here, normal rules for the boolean value of an
        # object are used thus all objects have a truth value.

    # this test does not work anymore since serial_for_url that is used
    # now, already sets a port


问题


面经


文章

微信
公众号

扫码关注公众号