def testMakeLargeProtoClass(self):
    """Test that large created protos don't use reserved field numbers."""
    num_fields = 123456
    fields = {
        'foo%d' % i: descriptor_pb2.FieldDescriptorProto.TYPE_INT64
        for i in range(num_fields)
    }
    proto_cls = proto_builder.MakeSimpleProtoClass(
        fields,
        full_name='net.proto2.python.public.proto_builder_test.LargeProtoTest')

    reserved_field_numbers = set(
        range(descriptor.FieldDescriptor.FIRST_RESERVED_FIELD_NUMBER,
              descriptor.FieldDescriptor.LAST_RESERVED_FIELD_NUMBER + 1))
    proto_field_numbers = set(proto_cls.DESCRIPTOR.fields_by_number)
    self.assertFalse(reserved_field_numbers.intersection(proto_field_numbers))
Test that large created protos don't use reserved field numbers.
deps/protobuf/python/google/protobuf/internal/proto_builder_test.py