3 SÉLjï¦ ã @ s$ d Z dZddlZyddlZW n ek r8 ddlZY nX ddlmZ ddlmZ ddlm Z ddlm Z ddlmZ dd lm Z dd lmZ ddlmZ ddlmZ dd lmZ dZG dd„ dejƒZG dd„ deƒZG dd„ dejƒZG dd„ dejƒZG dd„ dejƒZedk�r ejƒ dS )z1Unittest for google.protobuf.internal.descriptor.z#robinson@google.com (Will Robinson)é N)Úunittest_custom_options_pb2)Úunittest_import_pb2)Úunittest_pb2)Údescriptor_pb2)Úapi_implementation)Ú test_util)Ú descriptor)Údescriptor_pool)Úsymbol_database)Útext_formatz name: 'TestEmptyMessage' c @ s¤ e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd d „ Zdd„ Zd d„ Z dd„ Z dd„ Zdd„ Zdd„ Z dd„ Zdd„ Zdd„ Zejejƒ dkp’ejƒ dkdƒd d!„ ƒZd"S )#ÚDescriptorTestc C s t jddd�}|jjdd�}|jjddt jjt jjd� |jjd d�}|j jd dd� |j jd dd� |j jddd� |jjdd� |j jdd�}|jjdddd�}| jƒ | _ | j j|ƒ | j j|jƒ| _| jj|j | _| jj|j | _| jj|j | _| jj|j | _d S )Nzsome/filename/some.protoÚprotobuf_unittest)ÚnameÚpackageÚ NestedMessage)r Zbbé )r ÚnumberÚtypeÚlabelÚForeignEnumÚFOREIGN_FOOé )r r ZFOREIGN_BARé ZFOREIGN_BAZé ZResponseMessageZServiceZ CallMethodz .protobuf_unittest.NestedMessagez".protobuf_unittest.ResponseMessage)r Z input_typeZoutput_type)r ÚFileDescriptorProtoÚmessage_typeÚaddÚfieldZFieldDescriptorProtoZ TYPE_INT32ZLABEL_OPTIONALÚ enum_typeÚvalueZserviceÚmethodÚGetDescriptorPoolÚpoolZAddZFindFileByNamer Úmy_fileÚmessage_types_by_nameÚ my_messageÚenum_types_by_nameÚmy_enumÚservices_by_nameÚ my_serviceÚmethods_by_nameÚ my_method)ÚselfÚ file_protoZ message_protoZ enum_protoZ service_protoZmethod_proto© r. ú%/usr/lib/python3.6/descriptor_test.pyÚsetUp> s: zDescriptorTest.setUpc C s t jƒ jS )N)r ÚDefaultr" )r, r. r. r/ r! b s z DescriptorTest.GetDescriptorPoolc C s¨ | j | jjddƒdƒ | j | jjd jd j| jjddƒƒ | jtƒ� | jjddƒ W d Q R X | jtƒ� | jjddƒ W d Q R X | jtƒ� | jjƒ W d Q R X d S )Nr r r iç ZNoneEnum) ÚassertEqualr% Z EnumValueNamer&