def Match(self, encoded):
"""Whether or not |encoded| is compatible with this message instance.
If |encoded| has all required fields, and values of all fields are same to
those of this message instance, it is compatible. Otherwise, i.e
1) it doesn't have some required fields
2) it has some values of fields different from specified in |value_dict| of
this message instance
Args:
encoded: A string expected to be encoded with same encoding method of
this message instance.
Returns:
Whether or not |encoded| is compatible with this message instance.
"""
logging.log(1, 'Decoding %s: %s', self.name, encoded)
decoded = self.msg.encoding.ParseFromString(encoded, self.msg)
logging.info('Matching message value:\nExpected: %s\nActual: %s\n',
self.value_dict_or_array, decoded)
return MessageValue._MatchValue(self.value_dict_or_array, decoded)
评论列表
文章目录