def testmerge_active_shadow_file_no_shadow_enum(self): """merge_active_shadow_file doesn't require a shadow enum for new active enums.""" active_proto = descriptor_pb2.FileDescriptorProto() shadow_proto = descriptor_pb2.FileDescriptorProto() active_proto.enum_type.add().name = 'foo' target_proto = descriptor_pb2.DescriptorProto() target_proto = merge_active_shadow.merge_active_shadow_file(active_proto, shadow_proto) self.assertEqual(target_proto.enum_type[0].name, 'foo')
def testmerge_active_shadow_file_missing(self): """merge_active_shadow_file recovers missing messages from shadow.""" active_proto = descriptor_pb2.FileDescriptorProto() shadow_proto = descriptor_pb2.FileDescriptorProto() shadow_proto.message_type.add().name = 'foo' target_proto = descriptor_pb2.DescriptorProto() target_proto = merge_active_shadow.merge_active_shadow_file(active_proto, shadow_proto) self.assertEqual(target_proto.message_type[0].name, 'foo')