本文整理汇总了Python中coapthon.messages.message.Message._mid方法的典型用法代码示例。如果您正苦于以下问题:Python Message._mid方法的具体用法?Python Message._mid怎么用?Python Message._mid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coapthon.messages.message.Message
的用法示例。
在下文中一共展示了Message._mid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test_with_client_observe
# 需要导入模块: from coapthon.messages.message import Message [as 别名]
# 或者: from coapthon.messages.message.Message import _mid [as 别名]
def _test_with_client_observe(self, message_list, callback):
client = HelperClient(self.server_address)
token = None
last_mid = 0
for message, expected in message_list:
if message is not None:
token = message.token
client.send_request(message, callback)
received_message = self.queue.get()
if expected is not None:
last_mid = expected.mid
if expected.type is not None:
self.assertEqual(received_message.type, expected.type)
if expected.mid is not None:
self.assertEqual(received_message.mid, expected.mid)
self.assertEqual(received_message.code, expected.code)
if expected.source is not None:
self.assertEqual(received_message.source, self.server_address)
if expected.token is not None:
self.assertEqual(received_message.token, expected.token)
if expected.payload is not None:
self.assertEqual(received_message.payload, expected.payload)
if expected.options is not None:
self.assertEqual(received_message.options, expected.options)
message = Message()
message.type = defines.Types["RST"]
message.token = token
message._mid = last_mid
message.destination = self.server_address
client.send_empty(message)
client.stop()