
    iD                         d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ  G d d	ej                        Z
ed
k(  r ej                          yy)z(Tests for google.protobuf.proto_builder.    N)descriptor_pb2)
descriptor)descriptor_pool)proto_builder)text_formatc                   *    e Zd Zd Zd Zd Zd Zd Zy)ProtoBuilderTestc                     t        j                  dt        j                  j                  fdt        j                  j
                  fg      | _        t        | j                        | _        y )Nfoobar)	collectionsOrderedDictr   FieldDescriptorProto
TYPE_INT64TYPE_STRINGordered_fieldsdict_fields)selfs    }/var/www/catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/google/protobuf/internal/proto_builder_test.pysetUpzProtoBuilderTest.setUp-   sV    %11	33>>?	33??@3
 D ++,DL    c                     t        j                  | j                  d      } |       }d|_        d|_        | j                  dt        j                  |             y)z&Test that we can create a proto class.0net.proto2.python.public.proto_builder_test.Test	full_name90  asdfzbar: "asdf"
foo: 12345
N)r   MakeSimpleProtoClassr   r   r   assertMultiLineEqualr   MessageToStringr   	proto_clsprotos      r   testMakeSimpleProtoClassz)ProtoBuilderTest.testMakeSimpleProtoClass4   sS    22DFI KEEIEI#[%@%@%GIr   c                     t        j                  | j                  d      } |       }d|_        d|_        | j                  dt        j                  |             y)zBTest that the field order is maintained when given an OrderedDict.z7net.proto2.python.public.proto_builder_test.OrderedTestr   r   r   zfoo: 12345
bar: "asdf"
N)r   r   r   r   r   r    r   r!   r"   s      r   testOrderedFieldsz"ProtoBuilderTest.testOrderedFields?   sU    22KMI KEEIEI#[%@%@%GIr   c                     t        j                         }t        j                  | j                  d|      }t        j                  | j                  d|      }| j                  |j                  |j                         y)z%Test that the DescriptorPool is used.r   )r   poolN)r   DescriptorPoolr   r   r   assertIs
DESCRIPTOR)r   r)   
proto_cls1
proto_cls2s       r   testMakeSameProtoClassTwicez,ProtoBuilderTest.testMakeSameProtoClassTwiceJ   sh    ))+D33DJ 33DJ 	MM*'')>)>?r   c                    d}t        |      D ci c]   }d|z  t        j                  j                  " }}t	        j
                  |d      }t        t        t        j                  j                  t        j                  j                  dz               }t        |j                  j                        }| j                  |j                  |             yc c}w )z@Test that large created protos don't use reserved field numbers.i@ zfoo%dz:net.proto2.python.public.proto_builder_test.LargeProtoTestr      N)ranger   r   r   r   r   setr   FieldDescriptorFIRST_RESERVED_FIELD_NUMBERLAST_RESERVED_FIELD_NUMBERr,   fields_by_numberassertFalseintersection)r   
num_fieldsifieldsr#   reserved_field_numbersproto_field_numberss          r   testMakeLargeProtoClassz(ProtoBuilderTest.testMakeLargeProtoClassW   s    J z" 	!^88CCCF  22NPI !j((DD((CCaG	IJ i22CCD+889LMNs   %CN)__name__
__module____qualname__r   r%   r'   r/   r?    r   r   r	   r	   +   s    -	I	I@Or   r	   __main__)__doc__r   unittestgoogle.protobufr   r   r   r   r   TestCaser	   r@   mainrC   r   r   <module>rJ      sN   > /   * & + ) ';Ox(( ;O| z(--/ r   