本文整理汇总了Python中google.protobuf.internal.test_util.SetAllPackedExtensions方法的典型用法代码示例。如果您正苦于以下问题:Python test_util.SetAllPackedExtensions方法的具体用法?Python test_util.SetAllPackedExtensions怎么用?Python test_util.SetAllPackedExtensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类google.protobuf.internal.test_util
的用法示例。
在下文中一共展示了test_util.SetAllPackedExtensions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testSerializeAllPackedExtensions
# 需要导入模块: from google.protobuf.internal import test_util [as 别名]
# 或者: from google.protobuf.internal.test_util import SetAllPackedExtensions [as 别名]
def testSerializeAllPackedExtensions(self):
first_proto = unittest_pb2.TestPackedExtensions()
second_proto = unittest_pb2.TestPackedExtensions()
test_util.SetAllPackedExtensions(first_proto)
serialized = first_proto.SerializeToString()
bytes_read = second_proto.MergeFromString(serialized)
self.assertEqual(second_proto.ByteSize(), bytes_read)
self.assertEqual(first_proto, second_proto)
示例2: testGoldenPackedExtensions
# 需要导入模块: from google.protobuf.internal import test_util [as 别名]
# 或者: from google.protobuf.internal.test_util import SetAllPackedExtensions [as 别名]
def testGoldenPackedExtensions(self):
golden_data = test_util.GoldenFileData('golden_packed_fields_message')
golden_message = unittest_pb2.TestPackedExtensions()
golden_message.ParseFromString(golden_data)
all_set = unittest_pb2.TestPackedExtensions()
test_util.SetAllPackedExtensions(all_set)
self.assertEqual(all_set, golden_message)
self.assertEqual(golden_data, all_set.SerializeToString())
golden_copy = copy.deepcopy(golden_message)
self.assertEqual(golden_data, golden_copy.SerializeToString())
示例3: testGoldenPackedExtensions
# 需要导入模块: from google.protobuf.internal import test_util [as 别名]
# 或者: from google.protobuf.internal.test_util import SetAllPackedExtensions [as 别名]
def testGoldenPackedExtensions(self):
golden_data = test_util.GoldenFileData('golden_packed_fields_message')
golden_message = unittest_pb2.TestPackedExtensions()
golden_message.ParseFromString(golden_data)
all_set = unittest_pb2.TestPackedExtensions()
test_util.SetAllPackedExtensions(all_set)
self.assertEquals(all_set, golden_message)
self.assertEqual(golden_data, all_set.SerializeToString())
golden_copy = copy.deepcopy(golden_message)
self.assertEqual(golden_data, golden_copy.SerializeToString())
示例4: testGoldenPackedExtensions
# 需要导入模块: from google.protobuf.internal import test_util [as 别名]
# 或者: from google.protobuf.internal.test_util import SetAllPackedExtensions [as 别名]
def testGoldenPackedExtensions(self):
golden_data = test_util.GoldenFile('golden_packed_fields_message').read()
golden_message = unittest_pb2.TestPackedExtensions()
golden_message.ParseFromString(golden_data)
all_set = unittest_pb2.TestPackedExtensions()
test_util.SetAllPackedExtensions(all_set)
self.assertEquals(all_set, golden_message)
self.assertEqual(golden_data, all_set.SerializeToString())
golden_copy = copy.deepcopy(golden_message)
self.assertEqual(golden_data, golden_copy.SerializeToString())