<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>

hc           @   s  d  Z  d Z d d l Z y d d l Z Wn e k
 rG d d l Z n Xd d l m 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 d d
 l m Z d d l m Z d d l m Z d d l m Z d Z d e j f d     YZ d e f d     YZ d e j f d     YZ d e j f d     YZ d e j f d     YZ e d k re j   n  d S(   s1   Unittest for google.protobuf.internal.descriptor.s#   robinson@google.com (Will Robinson)iN(   t   unittest_custom_options_pb2(   t   unittest_import_pb2(   t   unittest_pb2(   t   descriptor_pb2(   t   api_implementation(   t	   test_util(   t
   descriptor(   t   descriptor_pool(   t   symbol_database(   t   text_formats   
name: 'TestEmptyMessage'
t   DescriptorTestc           B   s   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z e j e j   d k p e j   d k d  d    Z RS(   c      	   C   s  t  j d d d d  } | j j d d  } | j j d d d d d	 t  j j d
 t  j j  | j j d d  } | j	 j d d d d  | j	 j d d d d  | j	 j d d d d  | j j d d  | j
 j d d  } | j j d d d d d d  } |  j   |  _ |  j j |  |  j j | j  |  _ |  j j | j |  _ |  j j | j |  _ |  j j | j |  _ |  j j | j |  _ d  S(   Nt   names   some/filename/some.protot   packaget   protobuf_unittestt   NestedMessaget   bbt   numberi   t   typet   labelt   ForeignEnumt   FOREIGN_FOOi   t   FOREIGN_BARi   t   FOREIGN_BAZi   t   ResponseMessaget   Servicet
   CallMethodt
   input_types    .protobuf_unittest.NestedMessaget   output_types"   .protobuf_unittest.ResponseMessage(   R   t   FileDescriptorProtot   message_typet   addt   fieldt   FieldDescriptorProtot
   TYPE_INT32t   LABEL_OPTIONALt	   enum_typet   valuet   servicet   methodt   GetDescriptorPoolt   poolt   Addt   FindFileByNameR   t   my_filet   message_types_by_namet
   my_messaget   enum_types_by_namet   my_enumt   services_by_namet
   my_servicet   methods_by_namet	   my_method(   t   selft
   file_protot   message_protot
   enum_protot   service_protot   method_proto(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   setUp>   s:    						c         C   s   t  j   j S(   N(   R   t   DefaultR(   (   R4   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyR'   b   s    c         C   s   |  j  |  j j d d  d  |  j  |  j j d j d j |  j j d d   |  j t   |  j j d d  Wd  QX|  j t   |  j j d d  Wd  QX|  j t   |  j j   Wd  QXd  S(   NR   i   R   i  t   NoneEnum(	   t   assertEqualR-   t   EnumValueNameR.   t   values_by_numberR   t   assertRaisest   KeyErrort	   TypeError(   R4   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testEnumValueNamee   s    	c         C   s$   |  j  |  j |  j j d j  d  S(   Ni    (   R=   R/   t   valuesR   (   R4   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testEnumFixupst   s    c         C   s=   |  j  |  j |  j j d j  |  j  |  j |  j j  d  S(   Ni    (   R=   R-   t   fieldst   containing_typeR/   (   R4   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testContainingTypeFixupsw   s     c         C   s   |  j  |  j |  j j  d  S(   N(   R=   R1   R3   t   containing_service(   R4   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testContainingServiceFixups{   s    c         C   s   |  j  |  j j   t j    |  j  |  j j d j   t j    |  j  |  j j   t j    |  j  |  j j	 d j   t j
    |  j  |  j j   t j    |  j  |  j j   t j    d  S(   Ni    (   R=   R/   t
   GetOptionsR   t   EnumOptionsRD   t   EnumValueOptionsR-   t   MessageOptionsRF   t   FieldOptionsR3   t   MethodOptionsR1   t   ServiceOptions(   R4   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testGetOptions~   s    c         C   st  t  j } t  j j } | j d } | j d } | j d } | j d } | j d } t  j j } | j d  }	 | j	   }
 t  j
 } |  j d |
 j |  | j	   } t  j } |  j d | j |  | j	   } t  j } |  j d	 | j |  t  j } |  j d
 | j |  | j	   } t  j } |  j d | j |  | j	   } t  j } |  j d | j |  | j	   } t  j } |  j d | j |  | j	   } t  j } |  j d | j |  |	 j	   } t  j } |  j t  j | j |  t  j j } |  j | j  |  j | j  |  j | j  |  j | j  |  j | j  |  j | j  |  j | j  d  S(   Nt   field1t   AnOneoft   AnEnumt   ANENUM_VAL2t   ANENUM_VAL1t   Fool   `	 il   -a i*   iii{   l`	 (   R    t
   DESCRIPTORt   TestMessageWithCustomOptionst   fields_by_namet   oneofs_by_nameR.   t   enum_values_by_namet   TestServiceWithCustomOptionst   FindMethodByNameRK   t	   file_opt1R=   t
   Extensionst   message_opt1t
   field_opt1t
   field_opt2t
   oneof_opt1t	   enum_opt1t   enum_value_opt1t   service_opt1t   method_opt1t   METHODOPT1_VAL2t   DummyMessageContainingEnumt
   assertTruet   has_optionst   assertFalse(   R4   t   file_descriptort   message_descriptort   field_descriptort   oneof_descriptort   enum_descriptort   enum_value_descriptort   other_enum_value_descriptort   service_descriptort   method_descriptort   file_optionsR`   t   message_optionsRb   t   field_optionsRc   Rd   t   oneof_optionsRe   t   enum_optionsRf   t   enum_value_optionsRg   t   service_optionsRh   t   method_optionsRi   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testSimpleCustomOptions   s\    										c   
      C   s  d } d } d } d } d } d } t  j j } | j   } |  j t | j t  j  |  j | | j t  j  |  j | | j t  j	  |  j d | j t  j
  |  j d | j t  j  |  j | | j t  j  |  j | | j t  j  |  j d | j t  j  |  j d | j t  j  |  j | | j t  j  |  j | | j t  j  t  j j } | j   } |  j t | j t  j  |  j | | j t  j  |  j | | j t  j	  |  j | | j t  j
  |  j | | j t  j  |  j | | j t  j  |  j | | j t  j  |  j | | j t  j  |  j | | j t  j  |  j | | j t  j  |  j | | j t  j  t  j j } | j   } |  j d | j t  j  |  j d	 | j t  j d
  |  j d | j t  j  |  j d | j t  j  |  j d | j t  j  t  j }	 |  j |	 j | j t  j  t  j j } | j   } |  j d | j t  j d
  |  j d | j t  j  t  j j } | j   } |  j d | j t  j d
  |  j d | j t  j  d  S(   Ni   i   i?   i   i    i@   i    ig$(@i   gYB?s   Hello, "World"s   Hello Worldi   i   iifl        l     l            l         l        l    l            l    l        l    l            l    (   R    t   CustomOptionMinIntegerValuesRY   RK   R=   t   FalseRa   t   bool_optt	   int32_optt	   int64_optt
   uint32_optt
   uint64_optt
   sint32_optt
   sint64_optt   fixed32_optt   fixed64_optt   sfixed32_optt   sfixed64_optt   CustomOptionMaxIntegerValuest   Truet   CustomOptionOtherValuest   assertAlmostEqualt	   float_optt
   double_optt
   string_optt	   bytes_optRk   t   TEST_OPTION_ENUM_TYPE2t   enum_optt   SettingRealsFromPositiveIntst   SettingRealsFromNegativeInts(
   R4   t	   kint32mint	   kint64mint	   kint32maxt	   kint64maxt
   kuint32maxt
   kuint64maxRp   Ry   t
   dummy_enum(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testDifferentCustomOptionTypes   s    	c         C   sY  t  j j } | j   } |  j d | j t  j j  |  j d | j t  j j t  j  |  j d | j t  j j t  j	 j
  |  j d | j t  j j  |  j d | j t  j j t  j  |  j d | j t  j j j  |  j d | j t  j j j t  j  |  j d | j t  j j j t  j	 j
  |  j d	 | j t  j j t  j j  |  j d
 | j t  j j t  j j t  j  |  j d | j t  j j t  j j t  j	 j
  |  j d | j t  j j j j  |  j d | j t  j j j  |  j d | j t  j j
  |  j d | j t  j j j  |  j d | j t  j j  d  S(   Ni*   iD  il  i  i  i  i  i  i  i  iI  i  iA  i	   i   i   (   R    t   VariousComplexOptionsRY   RK   R=   Ra   t   complex_opt1t   foot   quuxt   corget   quxt   complex_opt2t   bazt   graultt   bart   garplyt   ComplexOptionType2t   ComplexOptionType4t   complex_opt4t   waldot   fredt   complex_opt3t   complexoptiontype5t   plught   complexopt6t   xyzzy(   R4   R   t   options(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testComplexExtensionOptions   sX    







c   	      C   s  t  j } t  j j } | j d } t  j j } | j d } t  j j } | j d  } | j   j	 t  j
 } |  j d | j  |  j d | j  |  j d | j j  |  j d | j j	 t  j
 j  |  j d | j j	 t  j j j  |  j d	 | j   j	 t  j j  |  j d
 | j   j	 t  j j  |  j d | j   j	 t  j j  |  j d | j   j	 t  j j  |  j d | j   j	 t  j j  |  j d | j   j	 t  j j  d  S(   Nt	   fieldnamet   VALUEt   Methodid   t   FileAnnotationt   NestedFileAnnotationt   FileExtensionAnnotationt   EmbeddedMessageSetElementt   MessageAnnotationt   FieldAnnotationt   EnumAnnotationt   EnumValueAnnotationt   ServiceAnnotationt   MethodAnnotation(   R    RY   t   AggregateMessageR[   t   AggregateEnumt   values_by_namet   AggregateServiceR_   RK   Ra   t   fileoptR=   t   it   st   subt   filet   msett   AggregateMessageSetElementt   message_set_extensiont   msgoptt   fieldoptt   enumoptt
   enumvaloptt
   serviceoptt	   methodopt(	   R4   Ro   Rp   Rq   Rs   Rt   Rv   Rw   Rx   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testAggregateOptionsR  sP    	
c         C   s   t  j j j } |  j d | j   j t  j  | j d } |  j d | j   j t  j	  t  j j } | j
 d } |  j d | j   j t  j  | j d } |  j d | j   j t  j  | j d } |  j d	 | j   j t  j  d  S(
   Ni  t   nested_fieldi  t
   NestedEnumi  t   NESTED_ENUM_VALUEi  t   nested_extensioni  (   R    t   NestedOptionTypeR   RY   R=   RK   Ra   Rb   R[   Rc   R.   Rf   R]   Rg   t   extensions_by_nameRd   (   R4   t   nested_messageR   t   outer_messaget   nested_enumt   nested_enum_valueR   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testNestedOptions  s     c         C   s6   |  j  |  j j |  j  |  j  |  j j |  j  d  S(   N(   R=   R/   R   R+   R-   (   R4   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testFileDescriptorReferences  s    c         C   s   |  j  |  j j d  |  j  |  j j d  |  j  |  j j |  j  |  j |  j j  |  j  d |  j j  t j	   } |  j j
 |  |  j  |  j j | j    |  j  t j j t j    d  S(   Ns   some/filename/some.protoR   t   proto2(   R=   R+   R   R   R(   Rn   Rm   t   syntaxR   R   t   CopyToProtot   serialized_pbt   SerializeToStringR   RY   R   R;   (   R4   R5   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testFileDescriptor  s    t   cppi   sA   Immutability of descriptors is only enforced in v2 implementationc         C   s}  t  j } t  j j } | j d } | j d } | j d } |  j t   d  | _ Wd  QX|  j t	   d  | j d <Wd  QX|  j t	   | j
 j d   Wd  QX|  j t   | | _ Wd  QX|  j t   t | _ Wd  QX|  j t   t | _ Wd  QX|  j t   t | _ Wd  QX|  j t   t | _ Wd  QX|  j t   } t | _ Wd  QX|  j d t | j   d  S(   Nt   optional_int32R   t   oneof_fieldt   Anothers&   attribute is not writable: has_options(   R   RY   t   TestAllTypesR[   R.   R\   R@   t   AttributeErrort   NoneRB   RF   t   appendRG   R   Rm   R   R=   t   strt	   exception(   R4   Ro   Rp   Rq   Rs   Rr   t   e(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testImmutableCppDescriptor  s2    		(   t   __name__t
   __module__R:   R'   RC   RE   RH   RJ   RR   R   R   R   R   R   R   R   t   unittestt   skipIfR   t   Typet   VersionR   (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyR
   <   s"   	$							6	^	2	1			!t   NewDescriptorTestc           B   s   e  Z d  Z d   Z RS(   sA   Redo the same tests as above, but with a separate DescriptorPool.c         C   s
   t  j   S(   N(   R   t   DescriptorPool(   R4   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyR'     s    (   R   R   t   __doc__R'   (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyR     s   t   GeneratedDescriptorTestc           B   s_   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   s:   Tests for the properties of descriptors in generated code.c         C   s  |  j  | j d  |  j  | j d  |  j  | |  |  j  | j d j |  |  j | | g  |  j | i d  | 6 |  j | j  |  j | j	  |  j | j
  |  j | j  |  j | j  |  j | j  |  j | j  |  j | j d j  |  j  | j g   d  S(   NR   s   protobuf_unittest.TestAllTypesi    (   R=   R   t	   full_nameRF   RG   t   assertInR   t   CheckDescriptorSequencet   CheckDescriptorMappingR[   t   fields_by_numbert   fields_by_camelcase_nameR.   R]   R\   t
   enum_typesR   t   extension_ranges(   R4   Rp   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   CheckMessageDescriptor  s"    c         C   s(  |  j  | j d  |  j  | j d  |  j  | j d  |  j  | j j d  |  j  | j t j  |  j  | |  |  j  | j j d |  |  j  | j j	 d |  |  j
 | | g  |  j
 | i d  | 6 |  j  d  | j  |  j  d  | j  t j   d k r$|  j  | j | j  n  d  S(   NR   t   optionalInt32s-   protobuf_unittest.TestAllTypes.optional_int32R   R   (   R=   R   t   camelcase_nameR  RG   R   R   RY   R[   R  R  R   t   extension_scopeR#   R   R   t   id(   R4   Rq   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   CheckFieldDescriptor  s(    	c         C   sK  |  j  | t j j j  |  j  | g   |  j  | d  |  j | d k  |  j | |  t |  } |  j | |  |  j t	 |  d  |  j t	 |  t	 |   |  j | t	 |  d | d  | d } |  j | | d  |  j
 | |  |  j | j |  d  |  j | j |  d  t j j j d } |  j | |  |  j | j |  d  |  j t | j |  |  j t | j g   t |  } |  j t |  t |  d  d  d   |  j t t |  d | d <|  j  | |  t j   d k r-|  j t t |   t |   n |  j t |  d d  d  S(   Ni   i    is   change valuet   pythont   <(   t   assertNotEqualR   t   TestAllExtensionsRY   RF   Rn   R=   t   listt   assertGreatert   lenR  t   indext   countt   NestedTestAllTypest   assertNotInR@   t
   ValueErrort   reversedt   StopIterationt   nextR   R   R   (   R4   t   sequencet   expected_listt   itemt
   other_itemt   reversed_iterator(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyR    s:    	"
)
%c            s    j  | t j j j    j  | i     j  | d    j | d k  t | j    }   j | |    j | |    j	 t
 |  d    j t
 |  t
 |   t j d k r t t | j     \ } } n | j   d \ } }   j | |    j | j |  |    j t   | j   Wd  QXt j   d k rj  j t | j g   n   j d  | j g    t t | j     t t | j     f }   j | t t | j      t j d k  rA  f d   } | | j   | j    | | j   | j    | | j   | j    n  d | | <  j  | |  | | =d | d <  j  | |    j t | j d	    j t | j t
 |  d  t j   d k r  j t
 t t | j      t
 t |    n   j t |  d d
  d  S(   Ni   i    i   R  c            s8     j  t |  |  d    j  t |  |  d  d  S(   Ni    i   (   R=   R  R  (   t   seqt   iterator(   R4   (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt
   CheckItemsB  s    s   change valuet   newt   new_keyt	   key_errorR  (   i   (   i   (   R  R   R  RY   R[   Rn   t   dictt   itemsR=   R  R  t   syst   version_infoR  t   iterR  t   getR@   RB   R   R   R   t   keysRD   t   iterkeyst
   itervaluest	   iteritemsRA   t   __getitem__R   (   R4   t   mappingt   excepted_dictt   keyR   R%  (    (   R4   sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyR  $  sJ    !0"

 7c         C   s   t  j j } |  j |  | j d } |  j |  | j d } |  j |  t  j j d } |  j d  | j
  |  j t  j j j d g  |  j t  j j j d d d g  d  S(   NR   R
  R   i   i    i*   i+   i/  i  i   (   i   i    (   i*   i+   (   i/  i  (   i   i    (   R   R   RY   R	  R[   R  R  R.   R=   R   RG   R  R  t   TestMultipleExtensionRanges(   R4   Rp   Rq   Rs   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testDescriptorU  s     	
c         C   ss   t  j } |  j | j  |  j | j  |  j | j  |  j | j  |  j | j  |  j t  j	 j j  d  S(   N(
   R   RY   R  t   dependenciesR  R,   R.   R0   R   t   TestNestedExtension(   R4   t   containing_file(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testCppDescriptorContainerh  s    	c         C   sB   t  j j j d } t | j  } ~ |  j d t |  j  d  S(   NR   t   FOO(	   R   R   RY   R.   R-  RD   R=   R  R   (   R4   t   enumt   values_iter(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt#   testCppDescriptorContainer_Iteratorr  s    c         C   sz   t  j j d } |  j | j d  |  j | j d j d  |  j | j t  j  |  j | j d  |  j	 | j
  d  S(   Nt   TestServicei    RX   (   R   RY   R0   R=   R   t   methodst   assertIsR   R  R  R2   (   R4   Rv   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testServiceDescriptory  s    c         C   sy   t  j j } | j d } |  j | j  |  j | | j  |  j d | j  |  j d | j	  |  j d | j
  d  S(   NR   s*   protobuf_unittest.TestAllTypes.oneof_fieldi    (   R   R   RY   R\   Rn   Rm   R=   RG   R   R  R  (   R4   Rp   Rr   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testOneofDescriptor  s    	
(   R   R   R   R	  R  R  R  R8  R<  R@  RD  RE  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyR     s   			#	1		
		t   DescriptorCopyToProtoTestc           B   s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z e j e j   d k d  d    Z e j e j   d k d  d    Z RS(   s)   Tests for CopyTo functions of Descriptor.c         C   sF   |   } t  j | |  |  j | | d t |  t |  f  d  S(   Ns#   Not equal,
Actual:
%s
Expected:
%s
(   R	   t   MergeR=   R   (   R4   t   actual_protot   expected_classt   expected_asciit   expected_proto(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   _AssertProtoEqual  s    	c         C   s-   |   } | j  |  |  j | | |  d  S(   N(   R   RL  (   R4   t   desct   expected_proto_classt   expected_proto_asciit   actual(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   _InternalTestCopyToProto  s    	c         C   s    |  j  t j j t j t  d  S(   N(   RQ  R   t   TestEmptyMessageRY   R   t   DescriptorProtot#   TEST_EMPTY_MESSAGE_DESCRIPTOR_ASCII(   R4   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testCopyToProto_EmptyMessage  s    	c         C   s)   d } |  j  t j j j t j |  d  S(   Ns   
      name: 'NestedMessage'
      field: <
        name: 'bb'
        number: 1
        label: 1  # Optional
        type: 5  # TYPE_INT32
      >
      (   RQ  R   R   R   RY   R   RS  (   R4   t   TEST_NESTED_MESSAGE_ASCII(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testCopyToProto_NestedMessage  s
    	c         C   s&   d } |  j  t j j t j |  d  S(   Ns   
      name: 'TestForeignNested'
      field: <
        name: 'foreign_nested'
        number: 1
        label: 1  # Optional
        type: 11  # TYPE_MESSAGE
        type_name: '.protobuf_unittest.TestAllTypes.NestedMessage'
      >
      (   RQ  R   t   TestForeignNestedRY   R   RS  (   R4   t   TEST_FOREIGN_NESTED_ASCII(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt$   testCopyToProto_ForeignNestedMessage  s
    
	c         C   s&   d } |  j  t j j t j |  d  S(   Ns   
      name: 'ForeignEnum'
      value: <
        name: 'FOREIGN_FOO'
        number: 4
      >
      value: <
        name: 'FOREIGN_BAR'
        number: 5
      >
      value: <
        name: 'FOREIGN_BAZ'
        number: 6
      >
      (   RQ  R   R   RY   R   t   EnumDescriptorProto(   R4   t   TEST_FOREIGN_ENUM_ASCII(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testCopyToProto_ForeignEnum  s
    	c         C   s&   d } |  j  t j j t j |  d  S(   Ns   
      name: 'TestDeprecatedFields'
      field: <
        name: 'deprecated_int32'
        number: 1
        label: 1  # Optional
        type: 5  # TYPE_INT32
        options: <
          deprecated: true
        >
      >
      (   RQ  R   t   TestDeprecatedFieldsRY   R   RS  (   R4   t   TEST_DEPRECATED_FIELDS_ASCII(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testCopyToProto_Options  s
    	c         C   s&   d } |  j  t j j t j |  d  S(   Ns}   
      name: 'TestEmptyMessageWithExtensions'
      extension_range: <
        start: 1
        end: 536870912
      >
      (   RQ  R   t   TestEmptyMessageWithExtensionsRY   R   RS  (   R4   t(   TEST_EMPTY_MESSAGE_WITH_EXTENSIONS_ASCII(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testCopyToProto_AllExtensions  s
    	c         C   s&   d } |  j  t j j t j |  d  S(   Ns  
      name: 'TestMultipleExtensionRanges'
      extension_range: <
        start: 42
        end: 43
      >
      extension_range: <
        start: 4143
        end: 4244
      >
      extension_range: <
        start: 65536
        end: 536870912
      >
      (   RQ  R   R7  RY   R   RS  (   R4   t*   TEST_MESSAGE_WITH_SEVERAL_EXTENSIONS_ASCII(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt!   testCopyToProto_SeveralExtensions  s
    	c         C   s+   d d d } |  j  t j t j |  d  S(   Nsd  
      name: 'google/protobuf/unittest_import.proto'
      package: 'protobuf_unittest_import'
      dependency: 'google/protobuf/unittest_import_public.proto'
      message_type: <
        name: 'ImportMessage'
        field: <
          name: 'd'
          number: 1
          label: 1  # Optional
          type: 5  # TYPE_INT32
        >
      >
      s  enum_type: <
        name: 'ImportEnum'
        value: <
          name: 'IMPORT_FOO'
          number: 7
        >
        value: <
          name: 'IMPORT_BAR'
          number: 8
        >
        value: <
          name: 'IMPORT_BAZ'
          number: 9
        >
      >
      enum_type: <
        name: 'ImportEnumForMap'
        value: <
          name: 'UNKNOWN'
          number: 0
        >
        value: <
          name: 'FOO'
          number: 1
        >
        value: <
          name: 'BAR'
          number: 2
        >
      >
      options: <
        java_package: 'com.google.protobuf.test'
        optimize_for: 1  # SPEED
      sG   
        cc_enable_arenas: true
      >
      public_dependency: 0
    (   RQ  R   RY   R   R   (   R4   t%   UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testCopyToProto_FileDescriptor  s    0c         C   s&   d } |  j  t j j t j |  d  S(   NsM  
      name: 'TestService'
      method: <
        name: 'Foo'
        input_type: '.protobuf_unittest.FooRequest'
        output_type: '.protobuf_unittest.FooResponse'
      >
      method: <
        name: 'Bar'
        input_type: '.protobuf_unittest.BarRequest'
        output_type: '.protobuf_unittest.BarResponse'
      >
      (   RQ  R   RA  RY   R   t   ServiceDescriptorProto(   R4   t   TEST_SERVICE_ASCII(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt!   testCopyToProto_ServiceDescriptorN  s
    	R  s    It is not implemented in python.c         C   s5   d } t  j j j d  } |  j | t j |  d  S(   Ns}   
      name: 'Foo'
      input_type: '.protobuf_unittest.FooRequest'
      output_type: '.protobuf_unittest.FooResponse'
    RX   (   R   RA  RY   R_   RQ  R   t   MethodDescriptorProto(   R4   RJ  Rw   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt    testCopyToProto_MethodDescriptora  s    		s!   Pure python does not raise error.c         C   s   t  j   } |  j t t j j j |  |  j t t j j j |  |  j t t j	 j j |  t  j
   } |  j t t j j |  d  S(   N(   R   R   R@   RB   R   RR  RY   R   R   RA  RS  R   (   R4   R5   t   proto(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testCopyToProto_TypeErrorr  s    					(   R   R   R   RL  RQ  RU  RW  RZ  R]  R`  Rc  Re  Rg  Rj  R   R   R   R   Rl  Rn  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyRF    s$   											;	t   MakeDescriptorTestc           B   s5   e  Z d    Z d   Z d   Z d   Z d   Z RS(   c   	      C   sr  t  j   } d | _ | j j   } | j | _ | j j   } d | _ | j j   } d | _ | j j   } d | _ d | _ | j	 j   } d | _ d | _ t
 j j | _ t
 j j | _ | j	 j   } d | _ d	 | _ t
 j j | _ t
 j j | _ d | _ | j	 j   } d | _ d
 | _ t
 j j | _ t
 j j | _ d | _ t
 j |  } |  j | j d j t
 j j  |  j | j d j t
 j j  |  j | j d j j |  |  j | j d j d j d  |  j | j d j d j | j d j d  |  j | j  |  j | j d j  t j    d k rn|  j! t"   t# | j d _ Wd  QXn  d  S(   Nt   Foo2t   SubR=  t   BARi   i   t   uint64_fieldi   t   nested_message_fieldt	   bar_fields   Foo2.Sub.FOOi    s   Foo2.Sub.bar_fieldR   ($   R   R   R   R   R   t   nested_typeR#   R$   R   R   R   t   FieldDescriptort   LABEL_REQUIREDR   t   TYPE_UINT64R   t   TYPE_MESSAGEt	   type_namet	   TYPE_ENUMt   MakeDescriptorR=   RF   t   cpp_typet   CPPTYPE_UINT64t   CPPTYPE_MESSAGERG   t   nested_typesR  R  Rn   Rm   R   R   R@   R   R   (	   R4   t   file_descriptor_protoR   Rv  R#   t   enum_type_valR   t
   enum_fieldt   result(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt"   testMakeDescriptorWithNestedFields  sX    													c         C   s#  t  j   } d | _ | j j   } | j | _ | j j   } d | _ | j j   } d | _ d | _ | j j   } d | _ d | _ t	 j
 j | _ t	 j
 j | _ | j j   } d | _ d | _ t	 j
 j | _ t	 j
 j | _ d	 | _ t	 j |  } |  j | j d
 j t	 j
 j  d  S(   NRX   R=  Rr  i   i   Rs  i   Ru  s   Foo.FOOi    (   R   R   R   R   R   R#   R$   R   R   R   Rw  Rx  R   Ry  R   R|  R{  R}  R=   RF   R~  R  (   R4   R  R   R#   R  R   R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt&   testMakeDescriptorWithUnsignedIntField  s.    									c         C   sa   t  j   } t j } | j j |  t j |  } | j   } |  j	 d | j
 t j j  d  S(   Nie   (   R   RS  R    R   RY   R   R   R}  RK   R=   Ra   R   R   (   R4   t   descriptor_protot   aggregate_messaget   reformed_descriptorR   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testMakeDescriptorWithOptions  s    		c         C   s   t  j   } d | _ d d d d d g } d d d d d g } xC t t |   D]/ } | j j   } | d | _ | | | _ qR Wt j	 |  } x8 t t |   D]$ } |  j
 | j | j | |  q Wd  S(	   Nt   Bart   foo_foot   FooBart   fooBazt   fooFoot   foobart   fooBari   (   R   RS  R   t   rangeR  R   R   R   R   R}  R=   RF   R  (   R4   R  t   namest   camelcase_namesR  R   R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testCamelcaseName  s    	c         C   s   t  j   } d | _ d d d d d d g } d d d d d d	 g } xC t t |   D]/ } | j j   } | d
 | _ | | | _ qX Wd	 | _ t	 j
 |  } x8 t t |   D]$ } |  j | j | j | |  q Wd  S(   Nt   TestJsonNamet
   field_namet	   fieldNamet	   FieldNamet   _field_namet
   FIELD_NAMEt	   json_namet	   FIELDNAMEs   @typei   (   R   RS  R   R  R  R   R   R   R  R   R}  R=   RF   (   R4   R  R  t
   json_namesR  R   R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   testJsonName  s    				(   R   R   R  R  R  R  R  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyRo    s
   	/		
	t   __main__(   R   t
   __author__R+  t	   unittest2R   t   ImportErrort   google.protobufR    R   R   R   t   google.protobuf.internalR   R   R   R   R   R	   RT  t   TestCaseR
   R   R   RF  Ro  R   t   main(    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/descriptor_test.pyt   <module>    s2    v