本文整理汇总了Python中packet.Packet.is_valid方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.is_valid方法的具体用法?Python Packet.is_valid怎么用?Python Packet.is_valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类packet.Packet
的用法示例。
在下文中一共展示了Packet.is_valid方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_long_body
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import is_valid [as 别名]
def test_long_body(self):
packet = Packet("1f07b1eeae1f07b1ee181f1a0eeb5701b202010a0101a000340034170d000208000186a019".decode('hex'))
self.assertTrue(packet.is_valid())
self.assertEqual(packet.body_len, 31)
self.assertEqual(packet.packet_type, Packet.PACKET_TYPE_PDM)
示例2: test_init_ack_packet_with_extraneous_data
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import is_valid [as 别名]
def test_init_ack_packet_with_extraneous_data(self):
packet = Packet("1f01482a5e1f01482ae51824c9e2fa95146a9a9444bbfa0f1474514e7d".decode('hex'))
self.assertTrue(packet.is_valid())
self.assertEqual(packet.packet_type, Packet.PACKET_TYPE_ACK)
示例3: test_con_packet
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import is_valid [as 别名]
def test_con_packet(self):
packet = Packet("1f07b1ee900000000000000251e2".decode('hex'))
self.assertTrue(packet.is_valid())
self.assertEqual(packet.packet_type, Packet.PACKET_TYPE_CON)
示例4: test_init_pdm_packet_with_extraneous_data
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import is_valid [as 别名]
def test_init_pdm_packet_with_extraneous_data(self):
packet = Packet("1f07b1eeae1f07b1ee181f1a0eeb5701b202010a0101a000340034170d000208000186a01912345678".decode('hex'))
self.assertTrue(packet.is_valid())
self.assertEqual(packet.packet_type, Packet.PACKET_TYPE_PDM)
示例5: test_ack_packet
# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import is_valid [as 别名]
def test_ack_packet(self):
packet = Packet("1f07b1ee4f1f07b1eeef".decode('hex'))
self.assertTrue(packet.is_valid())
self.assertEqual(packet.packet_type, Packet.PACKET_TYPE_ACK)