o
    ‹¨Êhº  ã                   @   s¶   d Z zddlmZ W n ey   ddlmZ Y nw zddlZW n ey-   ddlZY nw ddlmZ ddlm	Z	 ddlm
Z
 ddlmZ G dd	„ d	ejƒZed
krYe ¡  dS dS )z(Tests for google.protobuf.proto_builder.é    )ÚOrderedDictN)Údescriptor_pb2)Údescriptor_pool)Úproto_builder)Útext_formatc                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚProtoBuilderTestc                 C   s.   t dtjjfdtjjfgƒ| _t| jƒ| _d S )NÚfooÚbar)r   r   ÚFieldDescriptorProtoÚ
TYPE_INT64ÚTYPE_STRINGÚordered_fieldsÚdictÚ_fields)Úself© r   ú]/var/www/html/env/lib/python3.10/site-packages/google/protobuf/internal/proto_builder_test.pyÚsetUp4   s
   

þzProtoBuilderTest.setUpc                 C   ó8   t j| jdd�}|ƒ }d|_d|_|  dt |¡¡ dS )z&Test that we can create a proto class.ú0net.proto2.python.public.proto_builder_test.Test©Ú	full_nameé90  Úasdfzbar: "asdf"
foo: 12345
N)r   ÚMakeSimpleProtoClassr   r   r	   ÚassertMultiLineEqualr   ÚMessageToString©r   Ú	proto_clsÚprotor   r   r   ÚtestMakeSimpleProtoClass;   ó   þ
ÿz)ProtoBuilderTest.testMakeSimpleProtoClassc                 C   r   )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   r   r   r   ÚtestOrderedFieldsF   r!   z"ProtoBuilderTest.testOrderedFieldsc                 C   s@   t  ¡ }tj| jd|d�}tj| jd|d�}|  |j|j¡ dS )z%Test that the DescriptorPool is used.r   )r   ÚpoolN)r   ÚDescriptorPoolr   r   r   ÚassertIsÚ
DESCRIPTOR)r   r#   Ú
proto_cls1Ú
proto_cls2r   r   r   ÚtestMakeSameProtoClassTwiceQ   s   ýýz,ProtoBuilderTest.testMakeSameProtoClassTwiceN)Ú__name__Ú
__module__Ú__qualname__r   r    r"   r)   r   r   r   r   r   2   s
    r   Ú__main__)Ú__doc__Úcollectionsr   ÚImportErrorÚordereddictÚ	unittest2ÚunittestÚgoogle.protobufr   r   r   r   ÚTestCaser   r*   Úmainr   r   r   r   Ú<module>   s&    ÿÿ-ÿ