<!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           @   st  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z y d d l Z Wn e k
 rq 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 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 e j Z d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ  d e f d     YZ! d e f d     YZ" d e f d      YZ# d! e f d"     YZ$ d# e f d$     YZ% d% e f d&     YZ& e' d' k rpe j(   n  d S((   si   Unittest for reflection.py, which also indirectly tests the output of the
pure-Python protocol compiler.
iN(   t   unittest_import_pb2(   t   unittest_mset_pb2(   t   unittest_pb2(   t   descriptor_pb2(   t
   descriptor(   t   message(   t
   reflection(   t   text_format(   t   api_implementation(   t   more_extensions_pb2(   t   more_messages_pb2(   t   message_set_extensions_pb2(   t   wire_format(   t	   test_util(   t   testing_refleaks(   t   decodert   _MiniDecoderc           B   sk   e  Z d  Z d   Z d   Z e Z e Z e Z e Z d   Z	 e	 Z
 d   Z d   Z d   Z d   Z RS(   s  Decodes a stream of values from a string.

  Once upon a time we actually had a class called decoder.Decoder.  Then we
  got rid of it during a redesign that made decoding much, much faster overall.
  But a couple tests in this file used it to check that the serialized form of
  a message was correct.  So, this class implements just the methods that were
  used by said tests, so that we don't have to rewrite the tests.
  c         C   s   | |  _  d |  _ d  S(   Ni    (   t   _bytest   _pos(   t   selft   bytes(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   __init__O   s    	c         C   s%   t  j |  j |  j  \ } |  _ | S(   N(   R   t   _DecodeVarintR   R   (   R   t   result(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt
   ReadVarintS   s    !c         C   s   t  j |  j    S(   N(   R   t   ZigZagDecodeR   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt
   ReadSInt64\   s    c         C   s   t  j |  j    S(   N(   R   t	   UnpackTagR   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   ReadFieldNumberAndWireTypea   s    c         C   s=   t  j d |  j |  j |  j d ! d } |  j d 7_ | S(   Ns   <fi   i    (   t   structt   unpackR   R   (   R   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt	   ReadFloatd   s    *c         C   s=   t  j d |  j |  j |  j d ! d } |  j d 7_ | S(   Ns   <di   i    (   R   R   R   R   (   R   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt
   ReadDoublei   s    *c         C   s   |  j  t |  j  k S(   N(   R   t   lenR   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   EndOfStreamn   s    (   t   __name__t
   __module__t   __doc__R   R   t	   ReadInt32t	   ReadInt64t
   ReadUInt32t
   ReadUInt64R   t
   ReadSInt32R   R   R    R"   (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR   E   s   						t   ReflectionTestc           B   sS  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 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 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+ d*   Z, d+   Z- d,   Z. d-   Z/ d.   Z0 d/   Z1 d0   Z2 d1   Z3 d2   Z4 d3   Z5 d4   Z6 d5   Z7 d6   Z8 d7   Z9 d8   Z: d9   Z; d:   Z< d;   Z= d<   Z> d=   Z? d>   Z@ d?   ZA d@   ZB dA   ZC dB   ZD dC   ZE dD   ZF dE   ZG dF   ZH dG   ZI dH   ZJ dI   ZK dJ   ZL dK   ZM dL   ZN dM   ZO dN   ZP d[ dO  ZR dP   ZS eT jU eV jW   dQ k p	eV jX   dR k dS  dT    ZY dU   ZZ dV   Z[ dW   Z\ dX   Z] dY   Z^ dZ   Z_ RS(\   c         C   sU   |  j  t |  t |   x2 t t |   D] } |  j  | | | |  q/ Wd  S(   N(   t   assertEqualR!   t   range(   R   t   valuest   otherst   i(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   assertListsEqualt   s    c      	   C   sw   t  j d d d d d d d d   } |  j d | j  |  j d | j  |  j d | j  |  j | j d   d  S(   Nt   optional_int32i   t   optional_doubleg+)K@t   optional_stringt   optional_float(	   R   t   TestAllTypest   NoneR,   R2   R3   R4   t   assertFalset   HasField(   R   t   proto(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testScalarConstructory   s    		c         C   s   t  j d d d d d g d d d g d	 t t t g d
 d g d d   } |  j d d d d g t | j   |  j d d g t | j   |  j t t t g t | j	   |  j d g t | j
   |  j g  t | j   d  S(   Nt   repeated_int32i   i   i   i   t   repeated_doublegGz?g+)K@t   repeated_boolt   repeated_stringR4   t   repeated_float(   R   R6   t   Truet   FalseR7   R,   t   listR<   R=   R>   R?   R@   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedScalarConstructor   s    			%"c         C   s  t  j d t  j j d t  j j  t  j j d t  j j  g d t  j d d  t  j d d  t  j d d  g d t  j j   t  j j d	 d
  t  j j d	 d  g  } |  j t  j j d t  j j  t  j j d t  j j  g t | j	   |  j t  j d d  t  j d d  t  j d d  g t | j
   |  j t  j j   t  j j d	 d
  t  j j d	 d  g t | j   d  S(   Nt   repeated_nested_messaget   bbt   repeated_foreign_messaget   cii  i   t   repeatedgroupt   ai   i   (   R   R6   t   NestedMessaget   FOOt   BARt   ForeignMessaget   RepeatedGroupR,   RC   RE   RG   RI   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt    testRepeatedCompositeConstructor   s6    	c         C   s  t  j d d d d d d d g d t t t g d t  j j d	 t  j j  t  j j d	 t  j j  g d
 t  j d d  t  j d d  t  j d d  g d d   } |  j	 d | j
  |  j	 d | j  |  j	 d d g t | j   |  j	 t t t g t | j   |  j	 t  j j d	 t  j j  t  j j d	 t  j j  g t | j   |  j	 t  j d d  t  j d d  t  j d d  g t | j   |  j | j d   d  S(   NR2   i   R4   R=   gGz?g+)K@R>   RE   RF   RG   RH   ii  i   t   optional_nested_message(   R   R6   RA   RB   RK   RL   RM   RN   R7   R,   R2   R4   RC   R=   R>   RE   RG   R8   R9   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testMixedConstructor   s:    		"c         C   s   |  j  t t j d d |  j  t t j d d |  j  t t j d d |  j  t t j d d |  j  t t j d d g |  j  t t j d d |  j  t t j d d g |  j  t t j d d |  j  t t j d d g d  S(	   NR2   t   fooR4   i  RQ   R<   R?   RE   (   t   assertRaisest	   TypeErrorR   R6   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testConstructorTypeError   s$    c         C   s   t  j d d  } |  j d | j    t  j d t  j j    } |  j d | j    t  j d d g  } |  j d | j    t  j d t  j j   g  } |  j d | j    d  S(   NR2   i   i   RQ   i   R<   RE   (   R   R6   R,   t   ByteSizeRK   (   R   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt(   testConstructorInvalidatesCachedByteSize   s    		c         C   s   t  j   } |  j | j d   |  j d | j  |  j | j d   d | _ |  j | j d   | j d  |  j | j d   d  S(   NR2   i    i   (   R   R6   t
   assertTrueR9   R,   R2   t
   ClearField(   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSimpleHasBits   s    	c            sG     f d   } | d d  | d d  | d d  | d d	  d  S(
   Nc            s  t  j   } t | |   } t | |  }   j d |    j | j |     j | j |    d } t | | |    j | t | |   | }   j | j |     j | j |    | j |   t | |   }   j | j |     j | j |      j d t | |     j | | k	  t | | |    j | j |     j | j |      j d t | |   d  S(   Ni    i   (   R   R6   t   getattrR,   RY   R9   t   setattrRZ   (   t   composite_field_namet   scalar_field_nameR:   t   composite_fieldt   original_scalar_valuet   new_valt   old_composite_field(   R   (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   TestCompositeHasBits.  s,    t   optionalgroupRJ   RQ   RF   t   optional_foreign_messageRH   t   optional_import_messaget   d(    (   R   Rd   (    (   R   sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt!   testHasBitsWithSinglyNestedScalar  s
    "*c         C   s%   t  j   } | j } ~ d | _ d  S(   Ni   (   R   R6   RQ   RF   (   R   R:   t   nested(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testReferencesToNestedMessage]  s    	c         C   sr   t  j   } | j } | j d  |  j | | j k	  d | _ |  j | j d   |  j d | j j  d  S(   NRQ   i   i    (   R   R6   RQ   RZ   RY   RF   R9   R,   (   R   R:   Rj   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt0   testDisconnectingNestedMessageBeforeSettingFielde  s    		c         C   sK   t  j   } | j } | j d  ~ ~ t j   t  j   } | j } d  S(   NRQ   (   R   R6   RQ   RZ   t   gct   collect(   R   R:   Rj   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt5   testGetDefaultMessageAfterDisconnectingDefaultMessagen  s    	
c         C   s   t  j   } | j } d | _ |  j | j d   | j d  |  j d | j  |  j d | j j  |  j | | j k	  d | _ |  j | j d   |  j d | j j  d  S(   Ni   RQ   i    i   (   R   R6   RQ   RF   RY   R9   RZ   R,   (   R   R:   Rj   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt/   testDisconnectingNestedMessageAfterSettingField{  s    			c         C   sK   t  j   } |  j | j d   | j d  |  j | j d   d  S(   NRQ   (   R   R6   RY   R9   RZ   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt0   testDisconnectingNestedMessageBeforeGettingField  s    c         C   so   t  j   } t  j   } d | j _ | j |  |  j | j d   | j d  |  j | j d   d  S(   Ni   RQ   (   R   R6   RQ   RF   t	   MergeFromRY   R9   RZ   (   R   t   proto1t   proto2(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt(   testDisconnectingNestedMessageAfterMerge  s    c         C   sL   t  j   d k r d  St j   } d | j _ | j d  ~ t j   d  S(   Nt   pythoni   t   optional_lazy_message(	   R   t   TypeR   R6   Rw   RF   RZ   Rm   Rn   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt"   testDisconnectingLazyNestedMessage  s    c         C   s   t  j   } | j j j d  |  j d g | j j  |  j | j d   | j d  |  j | j d   | j j	 j
   |  j | j d   d  S(   Ni   RQ   (   R   t   TestNestedMessageHasBitsRQ   t   nestedmessage_repeated_int32t   appendR,   RY   R9   RZ   t%   nestedmessage_repeated_foreignmessaget   add(   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt&   testHasBitsWhenModifyingRepeatedFields  s    c         C   sq  t  j   } |  j | j d   |  j d | j j j j j j  |  j | j d   d | j j j j j _ |  j d | j j j j j j  |  j | j d   |  j | j j d   |  j | j j j d   |  j | j j j j d   |  j | j j j j j d   |  j | j j j j j j d   |  j | j j j j j j d   d  S(   NRF   i    i   RJ   R2   (   R   t   TestMutualRecursionARY   R9   R,   RF   RJ   R2   (   R   t   recursive_proto(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt!   testHasBitsForManyLevelsOfNesting  s    """&c         C   s   t  j   } d | _ d | _ d | _ | j } |  j | j j d d f | j j d d f | j j d d f g | j	    d | j _
 |  j | j j d d f | j j d d f | j j d d f | j j d | f g | j	    d  S(	   Ni   i   RS   R2   t   optional_fixed32R4   i{   RQ   (   R   R6   R   R2   R4   RQ   R,   t
   DESCRIPTORt   fields_by_namet
   ListFieldsRF   (   R   R:   t   nested_message(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSingularListFields  s$    					c      
   C   s   t  j   } | j j d  | j j d  | j j d  | j j d d g  | j j g   | j j d  | j j d   t d  D  d	 | _ | j	 |  j
 | j j d
 d	 f | j j d d d g f | j j d d g f | j j d d d d d d g f g | j    d  S(   Ni   i   i   RS   t   bart   bazc         s   s   |  ] } t  |  Vq d  S(   N(   t   str(   t   .0t   x(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pys	   <genexpr>  s    i   i   R2   R<   t   repeated_fixed32R?   t   0t   1(   R   R6   R   R|   R<   R?   t   extendR-   R2   R>   R,   R   R   R   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedListFields  s"     	c         C   sz   t  j   } d | j t  j <d | j t  j <d | j t  j <|  j t  j d f t  j d f t  j d f g | j    d  S(   Ni   i   RS   (   R   t   TestAllExtensionst
   Extensionst   optional_fixed32_extensiont   optional_int32_extensiont   optional_string_extensionR,   R   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSingularListExtensions  s    c         C   s  t  j   } | j t  j j d  | j t  j j d  | j t  j j d  | j t  j j d  | j t  j j d  | j t  j j d  d | j t  j <|  j t  j d f t  j d d g f t  j d g f t  j d d d g f g | j	    d  S(   Ni   i   i   RS   R   R   i   (
   R   R   R   t   repeated_fixed32_extensionR|   t   repeated_int32_extensiont   repeated_string_extensionR   R,   R   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedListExtensions  s    c         C   s   t  j   } t j |  t  j |  j | j j d d f t  j d f | j j d d f t  j d f | j j d d f g | j	    d  S(	   Nt   my_inti   i   t	   my_stringRS   R   t   my_floatg      ?(
   R   t   TestFieldOrderingsR   t   SetAllFieldsAndExtensionst   my_extension_intR,   R   R   t   my_extension_stringR   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testListFieldsAndExtensions  s    c         C   s  t  j   } |  j d | j  |  j d | j  |  j d | j  |  j d | j  |  j d | j  |  j d | j  |  j d | j	  |  j d | j
  |  j d | j  |  j d | j  |  j d | j  |  j d | j  |  j t | j  |  j d | j  |  j d | j  |  j d | j  |  j d | j  |  j d | j  |  j d | j  |  j d | j  |  j d	 | j  |  j d
 | j  |  j d | j  |  j d | j  |  j d | j  |  j d | j  |  j d | j  |  j t | j   |  j d | j!  |  j d | j"  |  j t  j j# | j$  |  j t  j% | j&  |  j t' j( | j)  t  j*   } |  j d | j+  d  S(   Ni    g        t    i)   i*   i+   i,   ii.   i/   i0   i1   ig     I@g     d@t   hellot   worldu   ሴ(,   R   R6   R,   R2   t   optional_int64t   optional_uint32t   optional_uint64t   optional_sint32t   optional_sint64R   t   optional_fixed64t   optional_sfixed32t   optional_sfixed64R5   R3   RB   t   optional_boolR4   t   optional_bytest   default_int32t   default_int64t   default_uint32t   default_uint64t   default_sint32t   default_sint64t   default_fixed32t   default_fixed64t   default_sfixed32t   default_sfixed64t   default_floatt   default_doubleRA   t   default_boolt   default_stringt   default_bytesRM   t   default_nested_enumt   FOREIGN_BARt   default_foreign_enumR    t
   IMPORT_BARt   default_import_enumt   TestExtremeDefaultValuest   utf8_string(   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testDefaultValues  sJ    
c         C   s&   t  j   } |  j t | j d  d  S(   Nt   nonexistent_field(   R   R6   RT   t
   ValueErrorR9   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt    testHasFieldWithUnknownFieldName@  s    c         C   s&   t  j   } |  j t | j d  d  S(   NR   (   R   R6   RT   R   RZ   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt"   testClearFieldWithUnknownFieldNameD  s    c            sf   t  j     x! t d  D] }   j j   q Wt  j   }   j |  |  j t   f d    d  S(   Ni
   c              s     j  d S(   Ni   (   t   repeated_message(    (   R:   (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   <lambda>Q  R   (   R   t   TestRequiredForeignR-   R   R~   t   CopyFromRT   t
   IndexError(   R   R0   Rt   (    (   R:   sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testClearRemovesChildrenH  s    c         C   s   t  j   } |  j t t | d d  |  j t t | d d g  |  j t t | d d  |  j t t | j d d  |  j t t | j d d  |  j t t | d d  d  S(	   NR<   i
   RQ   i   RF   i"   t   some_attributeR   (   R   R6   RT   t   AttributeErrorR]   RE   R@   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testDisallowedAssignmentsS  s    


c         C   s   t  j   } |  j t t | d d  |  j t t | d d  |  j t t | d d  |  j t t | d d  |  j t t | d d  |  j t t | d d  |  j t t | d	 d  t j   d
 k r |  j t t | d d  n	 d | _ d  S(   NR2   g?RS   R4   i
   R   R   R5   R3   Rv   (   R   R6   RT   RU   R]   R   Rx   R   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSingleScalarTypeSafetyh  s    c            s      f d   } | d d t   | d d t   | d d t   y
 t } Wn t k
 re t  } n Xt j d  d k r | d d |  n | d d t   | d	 d |  | d	 d |  | d d |  | d d |  d S(   s}   Verifies setting of scalar integers.

    Args:
      integer_fn: A function to wrap the integers that will be assigned.
    c            s}   t  j   }   |  } t | |  |   j t | |   |  t  j   } | j | j     j t | |   |  d  S(   N(   R   R6   R]   t   assertIsInstanceR\   t   ParseFromStringt   SerializeToString(   t
   field_namet   valuet   expected_typeR:   Rt   (   t
   integer_fnR   (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   TestGetAndDeserialize}  s    R2   i   i   R   t   Li   i   R   i<   R   Ni   @i   @l        l        i   @l            i   @l            (   t   intt   longt	   NameErrorR   t   calcsize(   R   R   R   t
   integer_64(    (   R   R   sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   assertIntegerTypesw  s    	

c         C   s   |  j  d    d  S(   Nc         S   s   |  S(   N(    (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR     R   (   R   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testIntegerTypes  s    c         C   s   |  j  t j  d  S(   N(   R   R   t   NonStandardInteger(   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testNonStandardIntegerTypes  s    c         C   s]   t  j   } |  j t   d | _ Wd  QX|  j t d   t j d d  | _ Wd  QXd  S(   Nt   2t   my_errori   (	   R   R6   RT   RU   R   t   assertRaisesRegexpt   RuntimeErrorR   R   (   R   t   pb(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testIllegalValuesForIntegers  s
    c            s      f d   } | d d d  | d d d  | d d d  | d
 d d  t  j   }  j t t f     d  | _ Wd QXt  j   }   d  | _  j d | j  d S(   s   Verifies bounds checking for scalar integer fields.

    Args:
      integer_fn: A function to wrap the integers that will be assigned.
    c            s   t  j   }   |  }   |  } t | |  |   j | t | |    t | |  |   j | t | |     j t t f t | |  | d   j t t f t | |  | d  d  S(   Ni   (   R   R6   R]   R,   R\   RT   R   RU   (   R   t   expected_mint   expected_maxR   (   R   R   (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   TestMinAndMaxIntegers  s    R2   i   i   R   i    l    R   i?   R   l    Nl        l     l        l    l            l         l            l    l            l         (   R   R6   RT   R   RU   R   t   optional_nested_enumR,   (   R   R   R   R   (    (   R   R   sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   assetIntegerBoundsChecking  s    c         C   s   |  j  d    d  S(   Nc         S   s   |  S(   N(    (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR     R   (   R   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSingleScalarBoundsChecking  s    c         C   s   |  j  t j  d  S(   N(   R   R   R   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt)   testNonStandardSingleScalarBoundsChecking  s    c         C   s'  t  j   } |  j t | j j d  |  j t | j j d  |  j t | j d  |  j t | j d  | j j d  d | j d <|  j t | j j	 d d  |  j t | j j	 d d  |  j t | j j	 d g   |  j t | j j	 d d  | j j d	  |  j t | j j	 d d  d  S(
   Ng?RS   i
   i   i    i  t   abct   indexR   (
   R   R6   RT   RU   R<   R|   R?   t   repeated_bytesR   t   __setitem__(   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedScalarTypeSafety  s    
c         C   sw   t  j   } |  j d | j  d | _ |  j d | j  d | _ |  j d | j  d | _ |  j d | j  d  S(   Ni    i   l    l    (   R   R6   R,   R2   R   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt!   testSingleScalarGettersAndSetters  s    			c         C   ss   t  j   } | j d  d | _ |  j | j d   | j d  |  j d | j  |  j | j d   d  S(   NR2   i   i    (   R   R6   RZ   R2   RY   R9   R,   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSingleScalarClearField  s    	c         C   s   t  j   } |  j d | j  |  j d t  j j  |  j d | j  |  j d t  j j  |  j d | j  |  j d t  j j  d  S(   Ni   i   i   (   R   R6   R,   RL   RM   t   BAZ(   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt	   testEnums  s    c         C   s~  |  j  d t j j t j   |  j  d t j j t j   |  j  d t j j t j   |  j t t j j d  t j	   } |  j  d | j
 j | j   |  j  d t j	 j
 j | j   |  j  d | j
 j | j   |  j  d t j	 j
 j | j   |  j  d | j
 j | j   |  j  d t j	 j
 j | j   |  j t | j
 j d  |  j t t j	 j
 j d  d  S(   Nt   FOREIGN_FOOR   t   FOREIGN_BAZi0,  RL   RM   R   (   R,   R   t   ForeignEnumt   NameR   R   R   RT   R   R6   t
   NestedEnumRL   RM   R   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testEnum_Name  s2    												c         C   s~  |  j  t j t j j d   |  j  t j t j j d   |  j  t j t j j d   |  j t t j j d  t j	   } |  j  | j
 | j j d   |  j  | j
 t j	 j j d   |  j  | j | j j d   |  j  | j t j	 j j d   |  j  | j | j j d   |  j  | j t j	 j j d   |  j t | j j d  |  j t t j	 j j d  d  S(	   NR   R   R   t   FORL   RM   R   t   Foo(   R,   R   R   R  t   ValueR   R   RT   R   R6   RL   R  RM   R   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testEnum_Value"  s2    			c         C   s	  |  j  d d d g t t j j     |  j  d d d g t t j j     |  j  d d d g t t j j     t j   } |  j  d d d	 d
 g t | j j     |  j  d d d d g t | j j     |  j  d d d d g t | j j     d  S(   NR   R   R   i   i   i   RL   RM   R   t   NEGi   i   i   i(   R   i   (   R   i   (   R   i   (   RL   i   (   RM   i   (   R   i   (   R	  i(	   R,   RC   R   R  t   keysR.   t   itemsR6   R  (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testEnum_KeysAndValues>  s    ++c         C   s  t  j   } |  j | j  |  j d t | j   | j j d  | j j d  | j j d  |  j | j  |  j d t | j   |  j d d d g | j  |  j d | j d  |  j d | j d  |  j t | j j	 d  |  j t | j j	 d  |  j t
 | j j	 d	  |  j t
 | j j	 d   d
 | j d <|  j d d
 d g | j  | j j d d  |  j d d d
 d g | j  | j j d  |  j d d
 d g | j d d ! |  j d d d
 d d g | j  d   t d  D | j d d +|  j d d d d d g | j  d d d g | j d d +|  j d d d d d g | j  g  } x | j D] } | j |  q{W|  j d d d d d g |  | j d =|  j d d d d g | j  | j d 3|  j d d g | j  | j j d d g  |  j d d d d g | j  | j d  |  j | j  |  j d t | j   | j j d  |  j d | j d  d | j d <|  j d | j d  d d d d g | j (| j d =|  j d d d g | j  | j d =|  j d d g | j  |  j t | j j d  |  j t | j j d  | j d d 5|  j d g | j  | j d d 5|  j d g | j  d  S(   Ni    i   i
   i   i   ii  i.RS   i   i   i   i   i   c         s   s   |  ] } | Vq d  S(   N(    (   R   R0   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pys	   <genexpr>r  s    i   i#   i(   i-   i   R<   iii,  id   i'  (   R   R6   RY   R<   R,   R!   R|   RT   R   t   __getitem__RU   R7   t   insertR-   R   RZ   t   __delitem__(   R   R:   R   R0   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedScalarsM  sl    ## ""



c         C   s  t  j   } |  j | j  |  j d t | j   | j j d  | j j d  | j j d  | j j d  |  j d t | j   | j j d  |  j d t | j   |  j d | j d  |  j d | j d  |  j d | j d  | j j d  |  j d t | j   |  j d | j d  |  j d | j d  | j j d  |  j d t | j   |  j d | j d  |  j t	 | j j d  d  S(	   Ni    i   i
   i   i   i   i   i{   (
   R   R6   RY   R<   R,   R!   R|   t   removeRT   R   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedScalarsRemove  s*    c         C   s$  t  j   } |  j | j  |  j d t | j   | j j   } | j j   } |  j | j  |  j d t | j   |  j | | g | j  |  j | t  j j	  |  j
 t | j j d  |  j
 t | j j d  |  j
 t | j j d  |  j
 t | j j d   | j j   } | j j   } | j j   } |  j | | | g | j d d ! |  j | | | | | g | j  |  j | | g | j d   |  j | | | g | j d  |  j | | j d  |  j | g | j d   g  } x | j D] } | j |  qW|  j | | | | | g |  | j d =|  j | | | | g | j  | j d 3|  j | | g | j  t  j j	 d d  }	 t  j j	 d d  }
 | j j |	 |
 g  |  j d t | j   |  j |	 | j d  |  j |
 | j d	  |  j
 t | j j |	  |  j
 t | j j d g  t  j   } |  j
 t | j j | g  | j d
  |  j | j  |  j d t | j   | j j d d  |  j d t | j   |  j d | j d j  |  j
 t | j j d  |  j
 t   d | j d <Wd  QXd  S(   Ni    i   i  i.RS   i   i   RF   i   RE   i   (   R   R6   RY   RE   R,   R!   R~   R1   R   RK   RT   R   R  RU   R7   R|   R   RZ   RF   t	   Exception(   R   R:   t   m0t   m1t   m2t   m3t   m4R   R0   t   n1t   n2t   wrong_message_type(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedComposites  s~    

				
c         C   s  t  j   } |  j d t | j   | j j   } t | j  | _ | j j   } t | j  | _ |  j | | k  | j j   } t | j  | _ |  j | | | g | j  |  j d t | j   | j j	 |  |  j d t | j   |  j | | j d  |  j | | j d  |  j
 t | j j	 |  |  j
 t | j j	 d   |  j d t | j   | j j	 |  |  j d t | j   |  j | | j d  d  S(   Ni    i   i   i   (   R   R6   R,   R!   RE   R~   RF   RY   R1   R  RT   R   R7   (   R   R:   R  R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedCompositeRemove  s*    c            sm  t  j   d k r d  St j } | d d d d d d d d	 d
 | j d | j d | j d d d d  d d  d d  d t d d  d t	 j
    } t j d d d d d d d d  d g  d g  d | g d g  d t	 j    	  d t j t j t j  f   f d     Y} |   } |  j d | j  |  j | j d   d | _ |  j d | j  |  j | j d   d  S(   NRv   t   namet	   foo_fieldt	   full_names   MyProto.foo_fieldR   i    t   numberi   t   typet   cpp_typet   labelt   default_valuet   containing_typet   message_typet	   enum_typet   is_extensiont   extension_scopet   optionst   MyProtot   filenamet   ignoredt   nested_typest
   enum_typest   fieldst
   extensionst   MyProtoClassc              s   e  Z   Z RS(    (   R#   R$   R   (    (   t   mydescriptor(    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR3  H  s   i   (   R   Rx   R   t   FieldDescriptort
   TYPE_INT64t   CPPTYPE_INT64t   LABEL_OPTIONALR7   RB   R   t   FieldOptionst
   Descriptort   MessageOptionst   sixt   with_metaclassR   t   GeneratedProtocolMessageTypeR   t   MessageR,   R  RY   R9   (   R   R5  t   foo_field_descriptorR3  t   myproto_instance(    (   R4  sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testHandWrittenReflection4  s.    			.		c            s  t  j   d k r d  S  f d     d   _ t j   } d | _ t j }   | d | j    | d | j    | d | j	    | d | j
    j d	 7_ | j j   } d
 | _ | j | _   j | _ t j j | _ t j |   |  j d  j k  |  j d  j k  |  j d  j k  |  j d  j k  |  j d
  j k  d t j t j t j  f  f d     Y} |   } d | _ d | _ t | _ d | _ | j j  d d g  | j!   } t j"  |  } |  j | | k	  |  j# | |  |  j# | j | j  |  j# | j | j  |  j# | j | j  |  j# | j | j  |  j# | j | j  d  S(   NRv   c            sO     j  d 7_  |  j j   } | | _ | | _   j  | _ t j j | _	 d  S(   Ni   (
   t   field_indext   fieldR~   R  R"  R!  R   t   FieldDescriptorProtoR8  R$  (   R:   R   t
   field_typet	   new_field(   t   AddDescriptorField(    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyRH  W  s    		i    t   CarR  t   yeart	   automatict   pricei   t   ownerst
   CarMessagec              s   e  Z   Z RS(    (   R#   R$   R   (    (   t   desc(    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyRN  w  s   t   priusi  g    @t   bobt   susan($   R   Rx   RC  R   t   DescriptorProtoR  RE  t   TYPE_STRINGR6  t	   TYPE_BOOLt   TYPE_DOUBLERD  R~   R"  R!  t   LABEL_REPEATEDR$  R   t   MakeDescriptorRY   R   R<  R=  R   R>  R   R?  RJ  RA   RK  RL  RM  R   R   t   ParseMessageR,   (   R   t
   desc_protot   fdpRG  RN  RP  t   serialized_priust	   new_prius(    (   RH  RO  sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testDescriptorProtoSupportQ  sN    				.					c         C   s   t  j   } t  j } |  j | j |   |  j d | j |  |  j | j |   d | j | <|  j d | j |  |  j | j |   | j |  |  j d | j |  |  j | j |   d  S(   Ni    i   (   R   R   R   RY   t   HasExtensionR,   R   t   ClearExtension(   R   t   extendee_protot	   extension(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt'   testTopLevelExtensionsForOptionalScalar  s    	c         C   s   t  j   } t  j } |  j d t | j |   | j | j d  |  j d g | j |  | j | } | j |  |  j d t | j |   |  j | | j | k	  |  j	 t
 t j | j | d  d  S(   Ni    RS   RJ   (   R   R   R   R,   R!   R   R|   R`  RY   RT   RU   t   operatort   setitem(   R   Ra  Rb  t   string_list(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt'   testTopLevelExtensionsForRepeatedScalar  s    	c         C   s=  t  j   } t  j } |  j | j |   |  j d | j | j  |  j | j |   d | j | _ |  j d | j | j  |  j | j |   | j | } | j |  |  j | | j | k	  d | _ |  j d | j  |  j | j	 d   |  j | j |   |  j
 t t j | j | d  d  S(   Ni    i   i*   RH   RJ   (   R   R   t"   optional_foreign_message_extensionRY   R_  R,   R   RH   R`  R9   RT   RU   Rd  Re  (   R   Ra  Rb  t   foreign_message(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt(   testTopLevelExtensionsForOptionalMessage  s"    		c         C   s  t  j   } t  j } |  j d t | j |   | j | j   } d | _ |  j d | j | d j  d | _ |  j d | j | d j  | j | } | j |  |  j d t | j |   |  j	 | | j | k	  |  j
 t t j | j | d  d  S(   Ni    i   i*   RJ   (   R   R   t   repeatedgroup_extensionR,   R!   R   R~   RJ   R`  RY   RT   RU   Rd  Re  (   R   Ra  Rb  t   groupt
   group_list(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt(   testTopLevelExtensionsForRepeatedMessage  s    			c         C   s   t  j   } t  j j } |  j | j |   | j | } |  j d | j  |  j | j |   d | _ |  j d | j | j  |  j | j |   | j	 |  |  j | | j | k	  |  j | j |   d  S(   Ni    i   (
   R   R   t   TestRequiredt   singleRY   R_  R   R,   RJ   R`  (   R   Ra  Rb  t   required(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testNestedExtensions  s    	c         C   sv   t  j j } |  j | j t  j j d   |  j | j d  j t  j j  |  j	 d t
 | j t  j j    d  S(   Ni   s*   protobuf_unittest.optional_int32_extensioni    (   R   R   t   poolRY   t   FindExtensionByNumberR   t   assertIst   FindExtensionByNameR&  R,   R!   t   FindAllExtensionsR6   (   R   Rs  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRegisteredExtensions  s    	c         C   s  t  j   } |  j | j d   |  j d | j j t  j  |  j | j d   d | j j t  j <|  j d | j j t  j  |  j | j d   t  j   } |  j | j d   |  j g  | j j t  j  |  j | j d   | j j t  j j	 d  |  j d g | j j t  j  |  j | j d   t  j   } |  j | j d   |  j d | j j t  j
 j  |  j | j d   d | j j t  j
 _ |  j d | j j t  j
 j  |  j | j d   t  j   } |  j | j d   |  j d t | j j t  j   |  j | j d   | j j t  j j   } |  j | | j j t  j d  |  j | j d   d  S(   Nt
   submessagei    i   (   R	   t   TopLevelMessageRY   R9   R,   Ry  R   t   optional_int_extensiont   repeated_int_extensionR|   t   optional_message_extensiont   foreign_message_intR!   t   repeated_message_extensionR~   (   R   t   toplevelt   foreign(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt(   testHasBitsForAncestorsOfExtendedMessage  sL    		c         C   s_   t  j   } | j } t  j } | j | } | j |  d | _ |  j | | j | k	  d  S(   Ni   (   R	   Rz  Ry  R}  R   R`  R~  RY   (   R   R  Ra  Rb  t   extension_proto(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt*   testDisconnectionAfterClearingEmptyMessage*  s    			c         C   s  t  j   } |  j t | j d  |  j t | j d  |  j t | j j d  |  j t | j j d d  x t	 j
 t	 j t	 j t	 j f D]g } |  j t | j |  |  j t | j |  |  j t | j j |  |  j t | j j | d  q W|  j t | j t  j  d  S(   Ni  i   (   R   R   RT   t   KeyErrorR_  R`  R   R  R   R	   R{  R}  R|  R  R   (   R   Ra  t   unknown_handle(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testExtensionFailureModes4  s&    	c         C   sK   t  j   } t j |  | j   } t  j j |  } |  j | |  d  S(   N(   R   R6   R   t   SetAllFieldsR   t
   FromStringR,   (   R   Rs   t   string1Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testStaticParseFromS  s
    c         C   sa   t  j   } d | _ t  j   } d | _ | j |  |  j d | j  |  j d | j  d  S(   Ni   R   (   R   R6   R2   R4   Rr   R,   (   R   Rs   Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testMergeFromSingularField]  s    		c         C   s   t  j   } | j j d  | j j d  t  j   } | j j d  | j |  |  j d | j d  |  j d | j d  |  j d | j d  d  S(   Ni   i   i    (   R   R6   R<   R|   Rr   R,   (   R   Rs   Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testMergeFromRepeatedFieldj  s    c         C   sK   t  j   } d | j _ t  j   } | j |  |  j d | j j  d  S(   Ni   (   R   R6   Re   RJ   Rr   R,   (   R   Rs   Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testMergeFromOptionalGroupx  s
    c         C   s,  t  j   } | j j   } d | _ | j j   } d | _ t  j   } | j j   } d | _ | j |  |  j d | j d j  |  j d | j d j  |  j d | j d j  t  j   } | j j | j  |  j d | j d j  |  j d | j d j  |  j d | j d j  d  S(   Ni{   iA  i  i    i   i   (   R   R6   RE   R~   RF   Rr   R,   (   R   Rs   t   mRt   t   proto3(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt"   testMergeFromRepeatedNestedMessage  s"    			c         C   sn   t  j   } t j |  t  j   } | j |  |  j | |  | j   } | j   } |  j | |  d  S(   N(   R   R6   R   R  Rr   R,   R   (   R   Rs   Rt   R  t   string2(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testMergeFromAllFields  s    c         C   sS   t  j   } d | j t  j <t  j   } | j |  |  j d | j t  j  d  S(   Ni   (   R   R   R   R   Rr   R,   (   R   Rs   Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testMergeFromExtensionsSingular  s    c         C   s   t  j   } | j t  j j d  | j t  j j d  t  j   } | j t  j j d  | j |  |  j d t | j t  j   |  j d | j t  j d  |  j d | j t  j d  |  j d | j t  j d  d  S(   Ni   i   i    i   (   R   R   R   R   R|   Rr   R,   R!   (   R   Rs   Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testMergeFromExtensionsRepeated  s    c         C   s   t  j   } | j t  j } | j   } d | _ | j   } d | _ t  j   } | j t  j } | j   } d | _ | j |  | j t  j } |  j d t |   |  j d | d j  |  j d | d j  |  j d | d j  d  S(   Ni   iM  io   i   i    i   i   (	   R   R   R   t!   repeated_nested_message_extensionR~   RF   Rr   R,   R!   (   R   Rs   t   ext1R  Rt   t   ext2(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt$   testMergeFromExtensionsNestedMessage  s&    
		
	
c         C   s\   t  j   } t  j   } | j |  j | j d   | j |  |  j | j d   d  S(   NRQ   (   R   R6   RQ   R8   R9   Rr   (   R   t   message1t   message2(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testMergeFromBug  s    c         C   sj   t  j   } d | _ d | _ t  j   } d | _ | j |  |  j d | j  |  j d | j  d  S(   Ni   s   important-textR   (   R   R6   R2   R4   R   R,   (   R   Rs   Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testCopyFromSingularField  s    			c         C   s   t  j   } | j j d  | j j d  t  j   } | j j d  | j |  |  j d | j d  |  j d | j d  d  S(   Ni   i   i    (   R   R6   R<   R|   R   R,   (   R   Rs   Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testCopyFromRepeatedField  s    c         C   sn   t  j   } t j |  t  j   } | j |  |  j | |  | j   } | j   } |  j | |  d  S(   N(   R   R6   R   R  R   R,   R   (   R   Rs   Rt   R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testCopyFromAllFields  s    c         C   s|   t  j   } | j j d  d | _ d | _ | j |  |  j d | j d  |  j d | j  |  j d | j  d  S(   Ni   i   s   important-texti    (   R   R6   R<   R|   R2   R4   R   R,   (   R   Rs   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testCopyFromSelf  s    		c         C   sH   t  j   d k r d  St j   } t j   } |  j t | j |  d  S(   NRv   (   R   Rx   R   R6   R   RT   RU   R   (   R   Rs   Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testCopyFromBadType  s
    c         C   s   t  j   } d | _ t j |  } |  j d | j  | j j d  | j j d  t j | j  } |  j d d g |  | j j	   } d | _
 t j | j  } |  j | j |  d | _
 |  j | j |  d  S(   Ni   i   i   (   R   R6   R2   t   copyt   deepcopyR,   R<   R|   RE   R~   RF   t   assertNotEqual(   R   Rs   Rt   t	   containerR  t   messages(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testDeepCopy   s    			c         C   s   t  j   } t j   d k r. t j |  n t j |  | j   |  j | j	   d  t  j   } |  j | |  t  j
   } t j |  | j   |  j | j	   d  t  j
   } |  j | |  d  S(   NRv   i    (   R   R6   R   Rx   R   R  t   SetAllNonLazyFieldst   ClearR,   RW   R   t   SetAllExtensions(   R   R:   t   empty_proto(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt	   testClear4  s    

c         C   se  t  j   } | j } | j   |  j | | j k	  d | _ |  j | j d   |  j d | j j  t  j   } | j } d | _ | j } d | _	 | j   |  j | | j k	  |  j | | j k	  |  j d | j  |  j d | j	  d | _ d | _	 |  j
 | j d   |  j d | j j  |  j
 | j d   |  j d | j j	  d  S(	   Ni   RQ   i    i   i   i   i   Rf   (   R   R6   RQ   R  RY   RF   R9   R,   Rf   RH   R8   (   R   R:   Rj   R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testDisconnectingBeforeClearK  s.    	
					
		c         C   s   t  j   } d | j _ | j } |  j | j j d  |  j | j j d  d | j _ |  j | j j d  |  j | j d  d | _ d  S(   Ni   i    i   i   (   R   t
   TestOneof2t   foo_messaget   qux_intR,   t   foo_lazy_message(   R   R  t   sub_message(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testDisconnectingInOneoff  s    	c         C   s   t  j   } d | _ d | j _ |  j d | j j  |  j | j d   | j } d | _ |  j d | j  |  j d | j  |  j | j d   d  S(   Ni
   i   t   oneof_uint32R   t   oneof_nested_message(	   R   R6   R  R  RF   R,   R8   R9   t   oneof_string(   R   R:   Rj   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt	   testOneOft  s    			c         C   s+   |  j  | j    | j   | j   d  S(   N(   RY   t   IsInitializedR   t   SerializePartialToString(   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   assertInitialized  s    
c         C   si   g  } |  j  | j    |  j  | j |   |  j | t |   |  j t j | j  | j   d  S(   N(	   R8   R  R,   R!   RT   R   t   EncodeErrorR   R  (   R   R:   t
   error_sizet   errors(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   assertNotInitialized  s    c         C   sZ  t  j   } |  j |  t  j   } |  j |  t  j   } |  j | d  d | _ | _ | _ |  j |  t  j	   } |  j |  d | j
 _ |  j | d  d | j
 _ d | j
 _ |  j |  | j j   } |  j | d  d | _ | _ | _ |  j |  t  j   } t  j j } | j | j   } | j | j   } |  j | d  d | _ d | _ d | _ |  j | d  d | _ d | _ d | _ |  j |  t  j   } t  j j } d | j | _ |  j | d  d | j | _ d | j | _ |  j |  g  } t  j   } |  j | j |   |  j | d d d g  d  S(	   Ni   i   i   i    i   RJ   t   bRH   (   R   R6   R  R   Ro  R  RJ   R  RH   R   t   optional_messageR   R~   t   multiR   Rp  R8   R  R,   (   R   R:   R  Rb  R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testIsInitialized  sV    						t   cppi   sB   Errors are only available from the most recent C++ implementation.c         C   s  d } d } t  j   } | | _ | | _ | j j   } d | _ t j | | d | j   d } | | _ | j j   } d | _ |  j	 t
   } t j | | d | j   |  j t | d  d t | j d | j   |  j d t | j   |  j d	 t | j   Wd  QXd  S(
   Ns!   test_file_descriptor_errors.protot   msg1t   serialized_pbs)   another_test_file_descriptor_errors.protot   msg2t	   exceptions   %s not raisedR#   s    test_file_descriptor_errors.msg1(   R   t   FileDescriptorProtoR  t   packageR'  R~   R   t   FileDescriptorR   RT   RU   RY   t   hasattrR\   t   expectedt   assertInR   R  (   R   t	   file_namet   package_namet   file_descriptor_protoR  t   another_file_nameR  t   cm(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testFileDescriptorErrors  s0    					c         C   s   t  j   } |  j t t | d d  |  j t | j  t j	  t j	 d  | _ |  j | j t
 d   t
 d  | _ |  j | j t j	 d   |  j t t | d d  d j d  } | | _ d | _ d | _ d  S(	   NR   u   unicode objectt   TestingR4   s   aau   Тестs   utf-8R   (   R   R6   RT   RU   R]   R,   R"  R4   R<  t	   text_typeR   R   t   encode(   R   R:   t
   utf8_bytes(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testStringUTF8Encoding  s    				c         C   s  t  j   } t  j } | j } d } | j d  } | | j | _ | j   } |  j | j	   t
 |   t j   } | j |  } |  j t
 |  |  t  j   }	 |  j d t
 | j   |  j | j d j d  |  j | j d j j |   |	 j | j d j  } |  j t
 | j d j  |  |  j t |	 j  t j  |  j |	 j |  | j d j j | t
 |  d  }
 t } y |	 j |
  Wn t k
 rt } n X|	 j } |  j | pt |  t k  d  S(   Nu   Тестs   utf-8i   i    iʿs   (   R   t   TestMessageSett   TestMessageSetExtension2t   message_set_extensionR  R   R   R   R,   RW   R!   R   t   RawMessageSett   MergeFromStringt   itemt   type_idRY   R   t   endswithR"  R<  R  t   replaceRB   t   UnicodeDecodeErrorRA   R   (   R   R:   t   extension_messageRb  t	   test_utf8t   test_utf8_bytest
   serializedt   rawt
   bytes_readR  t   badbytest   unicode_decode_failedt   string_field(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testStringUTF8Serialization  s8    		  	
	c         C   s/   t  j d d  } |  j d t j |   d  S(   NR   s    u#   optional_bytes: "\000\177\200\377"
(   R   R6   R,   R<  R  (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testBytesInTextFormat=  s    	c         C   s=  t  j   } | j j t  j j    |  j | j d   t  j   } | j j t  j j    |  j | j d   t  j   } | j j d  } |  j	 d |  |  j | j d   t  j   } | j j
 d  |  j | j d   | j   } t  j   } |  j	 t |  | j |   |  j | j d   d  S(   NRQ   R   i    (   R   R6   RQ   Rr   RK   RY   R9   R   R  R,   R   R   R!   (   R   R:   R  R  Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testEmptyNestedMessageB  s*    			c         C   sI   t  j   } |  j | j d   | j j   |  j | j d   d  S(   NRe   (   R   R6   R8   R9   Re   t   SetInParentRY   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSetInParent]  s    c         C   s9   d d l  m } | j j   } |  j d | j j  d S(   s  Test that we can import nested messages from their __init__.py.

    Such setup is not trivial since at the time of processing of __init__.py one
    can't refer to its submodules by name in code, so expressions like
    google.protobuf.internal.import_test_package.inner_pb2
    don't work. They do work in imports, so we have assign an alias at import
    and then use that alias in generated code.
    i(   t   import_test_packagei9   N(   t   google.protobuf.internalR  t   myprotot   OuterR,   t   innerR   (   R   R  t   msg(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testPackageInitializationImportc  s    N(`   R#   R$   R1   R;   RD   RP   RR   RV   RX   R[   Ri   Rk   Rl   Ro   Rp   Rq   Ru   Ry   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R  R  R  R  R  R  RB  R^  Rc  Rg  Rj  Rn  Rr  Rx  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R7   R  R  t   unittestt   skipIfR   Rx   t   VersionR  R  R  R  R  R  R  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR+   r   s   				"	#				Q																)						"				!											Z		S			=							1	
		
																								:! 		6			t   TestAllTypesEqualityTestc           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   s"   t  j   |  _ t  j   |  _ d  S(   N(   R   R6   t   first_protot   second_proto(   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   setUp{  s    c         C   s   |  j  t t |  j  d  S(   N(   RT   RU   t   hashR  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testNotHashable  s    c         C   s   |  j  |  j |  j  d  S(   N(   R,   R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSelfEquality  s    c         C   s   |  j  |  j |  j  d  S(   N(   R,   R  R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testEmptyProtosEqual  s    (   R#   R$   R  R   R  R  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR  y  s   			t   FullProtosEqualityTestc           B   sq   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 RS(   s@   Equality tests using completely-full protos as a starting point.c         C   sB   t  j   |  _ t  j   |  _ t j |  j  t j |  j  d  S(   N(   R   R6   R  R  R   R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR    s    c         C   s   |  j  t t |  j  d  S(   N(   RT   RU   R  R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR     s    c         C   s*   |  j  |  j d   |  j  d  |  j  d  S(   N(   R  R  R7   R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testNoneNotEqual  s    c         C   s6   t  j   } |  j |  j |  |  j | |  j  d  S(   N(   R   Ro  R  R  R  (   R   t   third_proto(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testNotEqualToOtherMessage  s    c         C   s   |  j  |  j |  j  d  S(   N(   R,   R  R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testAllFieldsFilledEquality  s    c         C   sR   |  j  j d 7_ |  j |  j  |  j  |  j  j d  |  j |  j  |  j  d  S(   Ni   R2   (   R  R2   R  R  RZ   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testNonRepeatedScalar  s    c         C   s   |  j  j j d 7_ |  j |  j  |  j  |  j  j j d 8_ |  j |  j  |  j  |  j  j j d  |  j |  j  |  j  |  j j j |  j  j _ |  j |  j  |  j  |  j  j d  |  j |  j  |  j  d  S(   Ni   RF   RQ   (   R  RQ   RF   R  R  R,   RZ   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testNonRepeatedComposite  s    c         C   sS   |  j  j j d  |  j |  j  |  j  |  j  j d  |  j |  j  |  j  d  S(   Ni   R<   (   R  R<   R|   R  R  RZ   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedScalar  s    c         C   s   |  j  j d j d 7_ |  j |  j  |  j  |  j  j d j d 8_ |  j |  j  |  j  |  j  j j   |  j |  j  |  j  |  j j j   |  j |  j  |  j  d  S(   Ni    i   (   R  RE   RF   R  R  R,   R~   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedComposite  s    c         C   s6   |  j  j d  d |  j _ |  j |  j  |  j  d  S(   NR2   i    (   R  RZ   R  R2   R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testNonRepeatedScalarHasBits  s    c         C   su   |  j  j d  |  j j j d  |  j |  j  |  j  d |  j  j _ |  j  j j d  |  j |  j  |  j  d  S(   NRQ   RF   i    (   R  RZ   R  RQ   R  RF   R,   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testNonRepeatedCompositeHasBits  s    (   R#   R$   R%   R  R   R  R  R  R  R	  R
  R  R  R  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR    s   										t   ExtensionEqualityTestc           B   s   e  Z d    Z RS(   c         C   sD  t  j   } t  j   } |  j | |  t j |  |  j | |  t j |  |  j | |  | j t  j c d 7<|  j | |  | j t  j c d 8<|  j | |  | j t  j  d | j t  j <|  j | |  d | j t  j <|  j | |  t  j   } t  j   } |  j d | j t  j  |  j | |  d  S(   Ni   i    (	   R   R   R,   R   R  R  R   R   R`  (   R   R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testExtensionEquality  s*    (   R#   R$   R  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR    s   t   MutualRecursionEqualityTestc           B   s   e  Z d    Z RS(   c         C   sp   t  j   } t  j   } |  j | |  d | j j j _ |  j | |  d | j j j _ |  j | |  d  S(   Ni   (   R   R   R,   RF   RJ   R2   R  (   R   R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testEqualityWithMutualRecursion  s    (   R#   R$   R  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR     s   t   ByteSizeTestc           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 d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s@   t  j   |  _ t j   |  _ t  j   |  _ t  j   |  _	 d  S(   N(
   R   R6   R:   R	   t   ExtendedMessaget   extended_protot   TestPackedTypest   packed_protot   TestPackedExtensionst   packed_extended_proto(   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR    s    c         C   s   |  j  j   S(   N(   R:   RW   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   Size  s    c         C   s   |  j  d |  j j    d  S(   Ni    (   R,   R:   RW   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testEmptyMessage  s    c         C   sN   t  j   } |  j d | j    t  j d d  } |  j d | j    d  S(   Ni    R   i   i   (   R   R6   R,   RW   (   R   R:   t   proto_kwargs(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSizedOnKwargs  s    c            s     f d   } | d d  | d d  xG t  t d d d  t d d   D]! \ } } | d | >d |  qN W| d d  | d	 d  | d d  d  S(   Nc            s7     j  j   |    j  _   j | d   j    d  S(   Ni   (   R:   R  R   R,   R  (   R0   t   expected_varint_size(   R   (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   Test#  s    i    i   i   i?   i'  ii
   il            l         (   t   zipR-   (   R   R  R0   t	   num_bytes(    (   R   sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testVarints"  s    1c         C   s   d |  j  _ |  j d |  j    d |  j  _ |  j d t |  j  j  |  j    d d |  j  _ |  j d t |  j  j  |  j    d  S(   NR   i   R   R   i   i   (   R:   R4   R,   R  R!   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testStrings1  s    &c         C   s   d |  j  _ |  j d |  j    t j   |  _  d |  j  _ |  j d |  j    t j   |  _  d |  j  _ |  j d |  j    t j   |  _  d |  j  _ |  j d |  j    t j   |  _  d |  j  _	 |  j d |  j    t j   |  _  d  S(   Ni  i   i	   gX9v?i@   i   (
   R:   R   R,   R  R   R6   R   R5   R3   R   (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testOtherNumerics>  s    c         C   s)   d |  j  j _ |  j d |  j    d  S(	   Ni   i   i   i   i @  i   i   i   (   R:   RQ   RF   R,   R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testCompositesX  s    c         C   s-   d |  j  j _ |  j d d |  j    d  S(   Ni   i   i   i   i    i   i   (   R:   Re   RJ   R,   R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt
   testGroups`  s    c         C   sD   |  j  j j d  |  j  j j d  |  j d d |  j    d  S(   Ni
   i   i   i   i   i   (   R:   R<   R|   R,   R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR  g  s    c         C   s7   |  j  j j d d g  |  j d d |  j    d  S(   Ni
   i   i   i   i   i   (   R:   R<   R   R,   R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedScalarsExtendm  s    c         C   sm   |  j  j j d  |  j  j j d  |  j d d |  j    |  j  j j d  |  j d |  j    d  S(   Ni
   i   i   i   i   i   i   (   R:   R<   R|   R,   R  R  (   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR  r  s
    c         C   sG   |  j  j j   } |  j  j j   } d | _ |  j d |  j    d  S(	   Ni   i   i   i   i   i   i   i   (   R:   RE   R~   RF   R,   R  (   R   t   foreign_message_0t   foreign_message_1(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR  z  s    	c         C   ss  |  j  j j   } |  j  j j   } d | _ |  j d |  j    t j |  j  j  } |  j  j d =|  j d |  j    |  j  j j   } d | _ |  j d |  j    |  j  j d =|  j d |  j    |  j  j d =|  j d |  j    |  j d t |   | d d 5t	 j
   d k r=|  j d t |   n  | d =t	 j
   d k ro|  j d t |   n  d  S(   Ni	   i   i   i    i   Rv   ii   i   i   i   i   i   i   i   i   i   i   i   i   i	   i
   i   i   i   (   R:   RE   R~   RF   R,   R  R  R  R!   R   Rx   (   R   R'  R(  RE   t   foreign_message_2(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedCompositesDelete  s,    		
c         C   sG   |  j  j j   } |  j  j j   } d | _ |  j d |  j    d  S(	   Ni   i   i   i   i   i   i	   i   (   R:   RI   R~   RJ   R,   R  (   R   t   group_0t   group_1(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testRepeatedGroups  s    	c         C   s   t  j   } |  j d | j    t  j } d | j | <|  j d | j    t  j j j d } |  j	 t
   d | j | <Wd  QXd  S(   Ni    i   i   R2   (   R   R   R,   RW   R   R   R6   R   R   RT   R  (   R   R:   Rb  RD  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testExtensions  s    	c         C   s   d |  j  _ |  j d |  j  j    d |  j  _ |  j d |  j  j    |  j  j d  |  j d |  j  j    t j } d |  j j | <|  j d |  j j    d |  j j | <|  j d |  j j    |  j j	 |  |  j d |  j j    d  S(   Ni   i   i   i   R2   i    (
   R:   R2   R,   RW   RZ   R	   R{  R  R   R`  (   R   Rb  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt)   testCacheInvalidationForNonrepeatedScalar  s    	c         C   s_  |  j  j j d  |  j d |  j  j    |  j  j j d  |  j d |  j  j    d |  j  j d <|  j d |  j  j    |  j  j d  |  j d |  j  j    t j } |  j j	 | } | j d  |  j d |  j j    | j d  |  j d	 |  j j    d | d <|  j d
 |  j j    |  j j
 |  |  j d |  j j    d  S(   Ni   i   i   i   i   R<   i    i   i   i   (   R:   R<   R|   R,   RW   RZ   R	   R|  R  R   R`  (   R   Rb  t   repeated(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt&   testCacheInvalidationForRepeatedScalar  s$    	
c         C   s  d |  j  j _ |  j d |  j  j    d |  j  j _ |  j d |  j  j    |  j  j j d  |  j d |  j  j    |  j  j d  |  j d |  j  j    t j   d	 k r |  j  j } |  j  j d  d | _ |  j d |  j  j    n  t j	 } |  j
 j | } |  j d |  j
 j    d | _ |  j d
 |  j
 j    d | _ |  j d |  j
 j    |  j
 j |  |  j d |  j
 j    d  S(   Ni   i   i   i   RH   i   Rf   i    Rv   i   (   R:   Rf   RH   R,   RW   RZ   R   Rx   R	   R}  R  R   R~  R`  (   R   t   childRb  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt*   testCacheInvalidationForNonrepeatedMessage  s,    				c         C   su  |  j  j j   } |  j d |  j  j    |  j  j j   |  j d |  j  j    d | _ |  j d |  j  j    |  j  j d  |  j d |  j  j    t j } |  j	 j
 | } | j   } |  j d |  j	 j    | j   |  j d |  j	 j    d | _ |  j d |  j	 j    | j d	  |  j d |  j	 j    |  j	 j |  |  j d |  j	 j    d  S(
   Ni   i   i   i   RG   i    i   i   R~  (   R:   RG   R~   R,   RW   RH   RZ   R	   R  R  R   R~  R`  (   R   t   child0Rb  t
   child_list(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt'   testCacheInvalidationForRepeatedMessage	  s(    		
	c         C   s   |  j  d |  j j    |  j j j d  |  j j j d  d } |  j  | |  j j    |  j j j d  |  j j j d  d } |  j  | | |  j j    |  j j d
  |  j  | |  j j    d  S(   Ni    i
   i   i   i   i   g@g      
@i   t   packed_int32i   i   i   i   (   R,   R  RW   R7  R|   t   packed_doubleRZ   (   R   t   int_sizet   double_size(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testPackedRepeatedScalars	  s    c         C   sb   |  j  d |  j j    |  j j t j } | j d d d d g  |  j  d |  j j    d  S(   Ni    i   i   i   i   i   (   R,   R  RW   R   R   t   packed_fixed32_extensionR   (   R   Rb  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testPackedExtensions0	  s
    	
(   R#   R$   R  R  R  R  R!  R"  R#  R$  R%  R  R&  R  R  R*  R-  R.  R/  R1  R3  R6  R;  R=  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR    s,   														'								t   SerializationTestc           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 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 RS(   c         C   ss   t  j   } t  j   } | j   } |  j | j   t |   |  j t |  | j |   |  j | |  d  S(   N(   R   R6   R   R,   RW   R!   R  (   R   R  R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSerializeEmtpyMessageF	  s    	c         C   s   t  j   } t  j   } t j |  | j   } |  j | j   t |   |  j t |  | j |   |  j | |  d  S(   N(	   R   R6   R   R  R   R,   RW   R!   R  (   R   R  R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSerializeAllFieldsP	  s    	c         C   sd   t  j   } t  j   } t j |  | j   } |  j t |  | j |   |  j | |  d  S(   N(   R   R   R   R  R   R,   R!   R  (   R   R  R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSerializeAllExtensions[	  s    	c         C   sc   t  j   } t  j   } d | j _ | j   } |  j t |  | j |   |  j | |  d  S(   Ni   (   R   R6   Re   RJ   R   R,   R!   R  (   R   R  R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSerializeWithOptionalGroupe	  s    	c         C   sn   t  j   } d | _ d	 | _ d | _ d | _ d | _ d | _ t  j j | j	    } |  j
 | |  d  S(   Nii   i(   ii   ii   l        l     l        l     l        l     (   R   R6   R2   R   R   R   R   R   R  R   R,   (   R   R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSerializeNegativeValueso	  s    							c         C   s$  t  j   d k r d  St j   } t j |  | j   } x t t |  d  D] } y t j   } t j	   } | j
 | d |  } |  j | |  y) | j
 | d |  } |  j | |  Wn! t j k
 r |  j d  n XWqR t j k
 r|  j t j | j
 | d |  qR XqR Wd  S(   NRv   i   i    s@   Parsing unknown fields failed when parsing known fields did not.(   R   Rx   R   R6   R   R  R   R-   R!   t   TestEmptyMessaget   _InternalParseR,   R   t   DecodeErrort   failRT   (   R   R  R  t   truncation_pointR  t   unknown_fieldst   post   pos2(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testParseTruncated~	  s&    c         C   s  t  j   } d | _ d | j t  j <d | _ d | j t  j <d | _ | j   } |  j	 | j
   t |   t |  } | j } |  j	 d t j f |    |  j	 d | j    |  j	 d t j f |    |  j	 d | j    |  j	 d t j f |    |  j	 d | j    |  j	 d t j f |    |  j	 d | j    |  j	 d t j f |    |  j	 d | j    d  S(   Ni   i   i   i   i   (   R
   t   OutOfOrderFieldsR   R   R   R   R   R2   R   R,   RW   R!   R   R   R   t   WIRETYPE_VARINTR&   R'   R(   R)   R*   (   R   R:   R  Rh   t   ReadTag(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testCanonicalSerializationOrder	  s(    				c         C   s6   t  j   } t j |  | j   } t j |  d  S(   N(   R   R   R   R   R   t#   ExpectAllFieldsAndExtensionsInOrder(   R   R:   R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt(   testCanonicalSerializationOrderSameAsCpp	  s    c         C   s   t  j   } | j j d  d | _ d | j _ | j   } t  j   } | j j d  d | _ d | j _ | j |  } |  j	 t
 |  |  |  j	 d d g t | j   |  j	 d | j  |  j	 d | j j  d  S(   Nt   foobari   i*   R   id   i  (   R   R6   R?   R|   R2   RQ   RF   R   R  R,   R!   RC   (   R   R  R  R  t   bytes_parsed(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt'   testMergeFromStringWhenFieldsAlreadySet	  s    		c         C   s  t  j   } t  j } t  j } | j } | j } t  j } d | j | _ d | j | _ d | j | _	 | j
   } t j   } |  j t | j j   j  |  j t |  | j |   |  j d t | j   t  j   }	 |  j t | j d j  |	 j | j d j   |  j d |	 j  t  j   }
 |  j t | j d j  |
 j | j d j   |  j d |
 j  t  j   } |  j t | j d j  | j | j d j   |  j d | j	  t  j   } |  j t |  | j |   |  j d | j | j  |  j d | j | j  |  j d | j | j	  |  j | j   t |   |  j | j   t |   d  S(   Ni{   RS   R   i   i    i   i   (   R   R  t   TestMessageSetExtension1R  R  t   message_set_extension3R   R0   R   t   textR   R   R  R,   RB   R   t
   GetOptionst   message_set_wire_formatR!   R  R  R   t   TestMessageSetExtension3RW   (   R   R:   t   extension_message1t   extension_message2t
   extension1t
   extension2t
   extension3R  R  R  R  t   message3Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testMessageSetWireFormat	  sR    								c         C   s9  t  j   } | j j   } d | _ t j } t j   } d | _ | j   | _	 | j j   } d | _ t j } t j   } d | _ | j   | _	 | j j   } d | _ t j
   } d | _ | j   | _	 | j   } t j   } |  j t |  | j |   t j } | j } |  j d | j | j  d  S(   Nii90  ii:0  iRS   (   R   R  R  R~   R  R   RV  R0   R   R   R  R   R  R,   R!   R  R  R   (   R   R  R  R\  R  R  R:   R^  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt(   testMessageSetWireFormatUnknownExtension	
  s4    											c         C   s   t  j   } t j |  | j   } t  j   } |  j t |  | j |   t  j   } d | _	 | j   } t  j   } |  j t |  | j |   d  S(   Nl   (
   R   R6   R   R  R   RD  R,   R!   R  R   (   R   R:   R  Rt   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testUnknownFields2
  s    			c         C   sU   y |   Wn* | k
 r7 } |  j  | t |   d SX|  j d t |    d S(   sE   This method checks if the excpetion type and message are as expected.Ns   %s not raised(   R,   R   t   failureException(   R   t	   exc_classt   callable_objR  t   ex(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   _CheckRaisesM
  s    c         C   s  t  j   } |  j t j | j d  | j   } t  j   } |  j | j d   | j	 |  |  j | j d   d | _
 |  j t j | j d  | j   } d | _ |  j t j | j d  | j   } d | _ | j   } | j   } t  j   } |  j t |  | j |   |  j d | j
  |  j d | j  |  j d | j  |  j t |  | j |   |  j d | j
  |  j d | j  |  j d | j  d  S(   NsH   Message protobuf_unittest.TestRequired is missing required fields: a,b,cRJ   i   sF   Message protobuf_unittest.TestRequired is missing required fields: b,ci   sD   Message protobuf_unittest.TestRequired is missing required fields: ci   (   R   Ro  Ri  R   R  R   R  R8   R9   R   RJ   R  RH   R,   R!   R  (   R   R:   t   partialRt   R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSerializeUninitializedX
  sL    					c         C   s   t  j   } | j   d | j _ |  j t j | j d  d | j _ d | j _	 | j   d | j
 j   _ d | j
 j   _ |  j t j | j d  d | j
 d _ d | j
 d _	 d | j
 d _ d | j
 d _	 | j   d  S(   Ni   so   Message protobuf_unittest.TestRequiredForeign is missing required fields: optional_message.b,optional_message.ci   i   s   Message protobuf_unittest.TestRequiredForeign is missing required fields: repeated_message[0].b,repeated_message[0].c,repeated_message[1].a,repeated_message[1].ci    (   R   R   R   R  RJ   Ri  R   R  R  RH   R   R~   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt$   testSerializeUninitializedSubMessage
  s*    

c         C   s   t  j   } t  j   } t j |  | j   } |  j | j   t |   | j |  } |  j | j   |  |  j | |  d  S(   N(	   R   R  R   t   SetAllPackedFieldsR   R,   RW   R!   R  (   R   R  R  R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testSerializeAllPackedFields
  s    c         C   sj   t  j   } t  j   } t j |  | j   } | j |  } |  j | j   |  |  j | |  d  S(   N(   R   R  R   t   SetAllPackedExtensionsR   R  R,   RW   (   R   R  R  R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt    testSerializeAllPackedExtensions
  s    c         C   s   t  j   } | j j d d g  | j j d  | j   } t  j   } | j j d  | j j d d g  | j j d  |  j t	 |  | j
 |   |  j d d d g | j  |  j d d d g | j  |  j d g | j  d  S(   Ni   i   g      @i   g      ?g       @i   (   R   R  R7  R   R8  R|   R   t   packed_sint32R,   R!   R  (   R   R  R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt1   testMergePackedFromStringWhenSomeFieldsAlreadySet
  s    	c         C   s  t  j   } | j j d d d d g  | j j d d g  | j j d  | j   } |  j | j	   t
 |   t |  } | j } |  j d t j f |    |  j d | j    |  j d | j    |  j d | j    |  j d | j    |  j d | j    |  j d	 t j f |    |  j d
 | j    |  j d | j    |  j d t j f |    |  j d | j    |  j d | j    |  j d | j    |  j | j    d  S(   Ni   i   i   i   g      ?g     @@g       @iZ   id   i   ie   i   i   i   i   i   (   R   R  R7  R   R8  t   packed_floatR|   R   R,   RW   R!   R   R   R   t   WIRETYPE_LENGTH_DELIMITEDR&   R   R    RY   R"   (   R   R:   R  Rh   RO  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testPackedFieldsWireFormat
  s,    	c         C   s}   t  j   } t j |  t  j   } | j   } |  j t |  | j |   t  j   } t j	 |  |  j | |  d  S(   N(
   R   t   TestUnpackedTypesR   t   SetAllUnpackedFieldsR  R   R,   R!   R  Rm  (   R   t   unpackedt   packedR  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testParsePackedFromUnpacked
  s    	c         C   s}   t  j   } t j |  t  j   } | j   } |  j t |  | j |   t  j   } t j	 |  |  j | |  d  S(   N(
   R   R  R   Rm  Rv  R   R,   R!   R  Rw  (   R   Ry  Rx  R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testParseUnpackedFromPacked
  s    	c         C   s   t  j   } |  j t  j j j d  |  j t  j j d  |  j t  j j d  |  j t  j j d  |  j t  j j d  |  j t  j j	 d  |  j t  j j
 d  |  j t  j j d  |  j t  j j d  d  S(	   Ni   i   i   i   i   i.   i0   i3   (   R   R6   R,   RK   t   BB_FIELD_NUMBERt   OPTIONAL_INT32_FIELD_NUMBERt   OPTIONALGROUP_FIELD_NUMBERt$   OPTIONAL_NESTED_MESSAGE_FIELD_NUMBERt!   OPTIONAL_NESTED_ENUM_FIELD_NUMBERt   REPEATED_INT32_FIELD_NUMBERt   REPEATEDGROUP_FIELD_NUMBERt$   REPEATED_NESTED_MESSAGE_FIELD_NUMBERt!   REPEATED_NESTED_ENUM_FIELD_NUMBER(   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testFieldNumbers  s    c         C   s  |  j  t j j j d  |  j  t j j d  |  j  t j j j d  |  j  t j j d  |  j  t j j d  |  j  t j	 d  |  j  t j
 j d  |  j  t j d  |  j  t j j d  |  j  t j d  |  j  t j j d  |  j  t j d  |  j  t j j d  |  j  t j d  |  j  t j j d  |  j  t j d  |  j  t j j d	  |  j  t j d	  |  j  t j j d
  |  j  t j d
  d  S(   Ni  i  i   i   i   i   i   i.   i0   i3   (   R,   R   Ro  Rp  R!  t   SINGLE_FIELD_NUMBERR  t   MULTI_FIELD_NUMBERR   t%   OPTIONAL_INT32_EXTENSION_FIELD_NUMBERt   optionalgroup_extensiont$   OPTIONALGROUP_EXTENSION_FIELD_NUMBERt!   optional_nested_message_extensiont.   OPTIONAL_NESTED_MESSAGE_EXTENSION_FIELD_NUMBERt   optional_nested_enum_extensiont+   OPTIONAL_NESTED_ENUM_EXTENSION_FIELD_NUMBERR   t%   REPEATED_INT32_EXTENSION_FIELD_NUMBERRk  t$   REPEATEDGROUP_EXTENSION_FIELD_NUMBERR  t.   REPEATED_NESTED_MESSAGE_EXTENSION_FIELD_NUMBERt   repeated_nested_enum_extensiont+   REPEATED_NESTED_ENUM_EXTENSION_FIELD_NUMBER(   R   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testExtensionFieldNumbers  s0    c         C   s  t  j d d d d d t d d d t  j j d	 d  d
 t  j d d  d t  j j d t  j d d d d g  	} |  j | j    |  j | j	 d   |  j | j	 d   |  j | j	 d   |  j | j	 d   |  j | j	 d   |  j | j	 d
   |  j | j	 d   |  j | j	 d   |  j
 d | j  |  j
 d | j  |  j
 t | j  |  j
 d | j  |  j
 d | j j  |  j
 d | j j  |  j
 t  j j | j  |  j
 t  j | j  |  j
 d d d g | j  d  S(   NR2   i   R4   RS   R   R   R   RQ   RF   Rf   RH   R   t   optional_foreign_enumR<   i   i   (   R   R6   RA   RK   RN   RL   R   RY   R  R9   R,   R2   R4   R   R   RQ   RF   Rf   RH   R   R  R<   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testInitKwargs+  s:    		
c         C   s    d   } |  j  t | d  d  S(   Nc          S   s   t  j d d  }  d  S(   Nt   unknown(   R   RD  (   t   unused_proto(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt(   InitalizeEmptyMessageWithExtraKeywordArgK  s    s9   Protocol message TestEmptyMessage has no "unknown" field.(   Ri  R   (   R   R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testInitArgsUnknownFieldNameJ  s
    	c         C   s   t  j d d d d d d  } |  j | j    |  j | j d   |  j | j d   |  j | j d   |  j | j d   |  j d | j  |  j d | j  |  j d | j  d  S(   NRJ   i   R  RH   t   dummy2(	   R   Ro  RY   R  R9   R,   RJ   R  RH   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testInitRequiredKwargsR  s    c      	   C   s?  t  j d t  j d d d d d d   } |  j | j    |  j | j d   |  j | j j    |  j | j j d   |  j | j j d   |  j | j j d   |  j | j j d   |  j t  j d d d d d d  | j  |  j d | j j  |  j d | j j	  |  j d | j j
  d  S(   NR  RJ   i   R  RH   R  (   R   R   Ro  RY   R  R9   R  R,   RJ   R  RH   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testInitRequiredForeignKwargs]  s    	!!
c         C   sw   t  j d d d d g  } |  j | j    |  j d | j d  |  j d | j d  |  j d | j d  d  S(   NR<   i   i   i   i    (   R   R6   RY   R  R,   R<   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testInitRepeatedKwargsm  s
    (   R#   R$   R?  R@  RA  RB  RC  RL  RP  RR  RU  Rb  Rc  Rd  Ri  Rk  Rl  Rn  Rp  Rr  Ru  Rz  R{  R  R  R  R  R  R  R  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR>  D	  s8   	
		
	
						6	)			3	!	
												t   OptionsTestc           B   s   e  Z d    Z d   Z RS(   c         C   sT   t  j   } |  j t | j j   j  t j   } |  j t	 | j j   j  d  S(   N(
   R   R  R,   RA   R   RY  RZ  R   R6   RB   (   R   R:   (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testMessageOptionsw  s    		c         C   s   t  j   } d | _ d | _ x3 | j   D]% \ } } |  j t | j   j  q+ Wt  j	   } | j
 j d  | j j d  xL | j   D]> \ } } |  j t | j   j  |  j t j j | j  q Wd  S(   Ni   g      @(   R   R6   R2   R3   R   R,   RB   RY  Ry  R  R7  R|   R8  RA   R   R5  RW  R$  (   R   R:   t   field_descriptort   _(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testPackedOptions  s    		(   R#   R$   R  R  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR  u  s   	t   ClassAPITestc           B   s   e  Z e j e j   d  k o- e j   d k d  d    Z d   Z e	 j
 d  d    Z e	 j
 d  d    Z e	 j
 d  d    Z RS(	   R  i   s6   C++ implementation requires a call to MakeDescriptor()c         C   s$  t  j d d d d d  d g  d g  d g  d g  } t  j d	 d
 d d d  d g  d | g d g  d g  } t  j d d d d d  d g  d g  d g  d g  } t  j d d d d d  d g  d | | g d g  d g  } t j |  } |  j d	 | j  |  j d | j  |  j d | j j  d  S(   Nt   leafs   package.parent.child.leafR   R&  R1  R/  R0  R2  R2  s   package.parent.childt   siblings   package.parent.siblingt   parents   package.parent(   R   R:  R7   R   t	   MakeClassR  t   __dict__R2  (   R   t	   leaf_desct
   child_desct   sibling_desct   parent_desct   message_class(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt!   testMakeClassWithNestedDescriptor  s(    			c         C   s4   d | d } t  j   } t j | |  | j   S(   s   Get a serialized representation of a test FileDescriptorProto.

    Args:
      name: All calls to this must use a unique message name, to avoid
          collisions in the cpp descriptor pool.
    Returns:
      A string containing the serialized form of a test FileDescriptorProto.
    s   message_type {  name: "si  "  field {    name: "flat"    number: 1    label: LABEL_REPEATED    type: TYPE_UINT32  }  field {    name: "bar"    number: 2    label: LABEL_OPTIONAL    type: TYPE_MESSAGE    type_name: "Bar"  }  nested_type {    name: "Bar"    field {      name: "baz"      number: 3      label: LABEL_OPTIONAL      type: TYPE_MESSAGE      type_name: "Baz"    }    nested_type {      name: "Baz"      enum_type {        name: "deep_enum"        value {          name: "VALUE_A"          number: 0        }      }      field {        name: "deep"        number: 4        label: LABEL_OPTIONAL        type: TYPE_UINT32      }    }  }}(   R   R  R   t   MergeR   (   R   R  t   file_descriptor_strt   file_descriptor(    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   _GetSerializedFileDescriptor  s    )s    MakeDescriptor is not repeatablec            s   t  j   d k r d St j   } | j |  j d   t j | j d    d t	 j
 t j t j  f   f d     Y} |   } d } t j | |  |  j | j d d d	 g  d S(
   s7   Test that the generated class can parse a flat message.Rv   Nt   Ai    t   MessageClassc              s   e  Z   Z RS(    (   R#   R$   R   (    (   t   msg_descriptor(    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR    s   s   flat: 0 flat: 1 flat: 2 i   i   (   R   Rx   R   R  R   R  R   RX  R'  R<  R=  R   R>  R   R?  R   R  R,   t   flat(   R   R  R  R  t   msg_str(    (   R  sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt0   testParsingFlatClassWithExplicitClassDeclaration  s    
.	c         C   s   t  j   } | j |  j d   t j | j d  } t j |  } |   } d } t	 j
 | |  |  j | j d d d g  d S(   s7   Test that the generated class can parse a flat message.t   Bi    s   flat: 0 flat: 1 flat: 2 i   i   N(   R   R  R   R  R   RX  R'  R   R  R   R  R,   R  (   R   R  R  t	   msg_classR  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testParsingFlatClass  s    	c         C   s   t  j   } | j |  j d   t j | j d  } t j |  } |   } d } t	 j
 | |  |  j | j j j d  d S(   s9   Test that the generated class can parse a nested message.t   Ci    s   bar {  baz {    deep: 4  }}i   N(   R   R  R   R  R   RX  R'  R   R  R   R  R,   R   R   t   deep(   R   R  R  R  R  R  (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   testParsingNestedClass  s    	(   R#   R$   R  R  R   Rx   R  R  R  R   t   SkipReferenceLeakCheckerR  R  R  (    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyR    s   !	8t   __main__()   R%   R  Rm   Rd  R<  R   t	   unittest2R  t   ImportErrort   google.protobufR    R   R   R   R   R   R   R   R  R   R	   R
   R   R   R   R   R   t   BaseTestCaset   objectR   R+   R  R  R  R  R  R>  R  R  R#   t   main(    (    (    sL   /usr/lib/python2.7/site-packages/google/protobuf/internal/reflection_test.pyt   <module>#   s`   	-       V! 9  3