<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>

hc           @   s)  d  Z  d Z d d l Z d d l Z d d l Z d d l Z y d d l Z Wn e k
 rk 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 e j f d     YZ d e j f d     YZ e
 j e e  d e f d     Y Z d e f d     YZ d e f d     YZ d e j f d     YZ d e j f d     YZ e
 j e e  d e f d     Y Z  e! d k r%e j"   n  d S(    s%   Test for google.protobuf.text_format.s    kenton@google.com (Kenton Varda)iN(   t   _parameterized(   t   any_test_pb2(   t   map_unittest_pb2(   t   unittest_mset_pb2(   t   unittest_pb2(   t   unittest_proto3_arena_pb2(   t   api_implementation(   t   message_set_extensions_pb2(   t	   test_util(   t   descriptor_pool(   t   text_formatt   SimpleTextFormatTestsc           B   s   e  Z d    Z RS(   c         C   s.   x' t  j D] } |  j d t |   q
 Wd  S(   Ni   (   R
   t   _QUOTESt   assertEqualt   len(   t   selft   quote(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testQuoteMarksAreSingleCharsF   s    (   t   __name__t
   __module__R   (    (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyR   @   s   t   TextFormatBasec           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   sR   t  j |  = } t t k r( | j   Sg  | D] } | j d  ^ q/ SWd  QXd  S(   Ns   utf-8(   R   t
   GoldenFilet   strt   bytest	   readlinest   decode(   R   t   golden_filenamet   ft   golden_line(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt
   ReadGoldenN   s    c         C   s,   |  j  |  } |  j | d j |   d  S(   Nt    (   R   t   assertMultiLineEqualt   join(   R   t   textR   t   golden_lines(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   CompareToGoldenFileS   s    c         C   s   |  j  | |  d  S(   N(   R   (   R   R!   t   golden_text(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   CompareToGoldenTextW   s    c         C   s[   | j  d d  j  d d  j  d d  j  d d  } t j d t j  j d |  } | S(   Ns   e+0s   e+s   e-0s   e-s   \.0$R   (   t   replacet   ret   compilet	   MULTILINEt   sub(   R   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   RemoveRedundantZerosZ   s    !(   R   R   R   R#   R%   R+   (    (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyR   L   s   			t   TextFormatTestc           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 d   Z d   Z RS(   c         C   s   | j    } | 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	 |   d  d  S(	   Nl         l    gw/^@gtQFքDg6<s    
	\'"u   üꜟs   repeated_int64: -9223372036854775808
repeated_uint64: 18446744073709551615
repeated_double: 123.456
repeated_double: 1.23e+22
repeated_double: 1.23e-18
repeated_string: "\000\001\007\010\014\n\r\t\013\\\'\""
repeated_string: "\303\274\352\234\237"
(
   t   TestAllTypest   repeated_int64t   appendt   repeated_uint64t   repeated_doublet   repeated_stringR%   R+   R
   t   MessageToString(   R   t   message_modulet   message(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintExotich   s    c         C   sX   d t  j f d     Y} | j   } | j j | d   |  j t j |  d  d  S(   Nt
   UnicodeSubc           B   s   e  Z RS(    (   R   R   (    (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyR7   ~   s   u   üꜟs(   repeated_string: "\303\274\352\234\237"
(   t   sixt	   text_typeR-   R2   R/   R%   R
   R3   (   R   R4   R7   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintExoticUnicodeSubclass|   s    c         C   sG   | j    } | j j   } d | _ |  j t j | d t d  d  S(   Ni*   t   as_one_lines"   repeated_nested_message { bb: 42 }(   R-   t   repeated_nested_messaget   addt   bbR%   R
   R3   t   True(   R   R4   R5   t   msg(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintNestedMessageAsOneLine   s    	c         C   s   | j    } | j j d  | j j d  | j j d  | j j d  | j j d  |  j t j | d t d  d  S(   Ni   i   t   Googlet   ZurichR;   si   repeated_int32: 1 repeated_int32: 1 repeated_int32: 3 repeated_string: "Google" repeated_string: "Zurich"(   R-   t   repeated_int32R/   R2   R%   R
   R3   R?   (   R   R4   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt    testPrintRepeatedFieldsAsOneLine   s    c         C   s8   | j    } d | _ |  j t j | d t d  d  S(   Ns
   a
new
lineR;   s   optional_string: "a\nnew\nline"(   R-   t   optional_stringR%   R
   R3   R?   (   R   R4   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt'   testPrintNestedNewLineInStringAsOneLine   s
    	c         C   s   | j    } | 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	 | d t
  d	  d  S(
   Nl         l    gw/^@gtQFքDg6<s    
	\'"u   üꜟR;   s   repeated_int64: -9223372036854775808 repeated_uint64: 18446744073709551615 repeated_double: 123.456 repeated_double: 1.23e+22 repeated_double: 1.23e-18 repeated_string: "\000\001\007\010\014\n\r\t\013\\\'\"" repeated_string: "\303\274\352\234\237"(   R-   R.   R/   R0   R1   R2   R%   R+   R
   R3   R?   (   R   R4   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintExoticAsOneLine   s    c         C   s?  | j    } | j j d  | j j d  | j j d  | j j d  | j j d  | j j d  | j j d  t j | d t d	 t	 } | j    } t j
 | |  } |  j | |  |  j | |  t j | d t d	 t } | j    } t j
 | |  } |  j | |  |  j | | d
 | | f  d  S(   Nl         l    gw/^@gtQFքDg6<s    
	\'"u   üꜟR;   t   as_utf8s	   
%s != %s(   R-   R.   R/   R0   R1   R2   R
   R3   R?   t   Falset   Parset   assertIsR   (   R   R4   R5   t	   wire_textt   parsed_messaget   r(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testRoundTripExoticAsOneLine   s.    		c         C   s~   | j    } | j j d  t j | d t } |  j | d  | j    } t j | |  |  j | | d | | f  d  S(   Nu   üꜟRI   s   repeated_string: "üꜟ"
s	   
%s != %s(	   R-   R2   R/   R
   R3   R?   R%   RK   R   (   R   R4   R5   R!   RN   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintRawUtf8String   s    c         C   s   | j    } d | j _ d | j _ | j j j d  | j j j d  d d d d g } t j | d	 d
 } |  j	 |  j
 |  d j |    t j | d t d	 d
 } |  j	 |  j
 |  d j |    d  S(   Ng      ?g/_e̾ig⹭?s   optional_float: 1.25s%   optional_double: -3.45678901234568e-6s   repeated_float: -5642s   repeated_double: 7.89e-5t   float_formats   .15gs&   payload {{
  {0}
  {1}
  {2}
  {3}
}}
R;   s   payload {{ {0} {1} {2} {3} }}(   t   NestedTestAllTypest   payloadt   optional_floatt   optional_doublet   repeated_floatR/   R1   R
   R3   R%   R+   t   formatR?   (   R   R4   R5   t   formatted_fieldst   text_message(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintFloatFormat   s&    
	c         C   s/   | j    } d | _ |  j d t |   d  S(   Ni{   s   c: 123
(   t   ForeignMessaget   cR   R   (   R   R4   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testMessageToString   s    	c         C   s   | j    } | j j d } | j } t j t  } t j | | |  |  j d | j	    | j
   t j t  } t j |  } | j | |  |  j d | j	    | j
   d  S(   NRU   s   optional_float: 0.0
(   R-   t
   DESCRIPTORt   fields_by_nameRU   R
   t
   TextWriterRJ   t
   PrintFieldR   t   getvaluet   closet   _Printer(   R   R4   R5   t   fieldt   valuet   outt   printer(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintField  s    	
c         C   s   | j    } | j j d } | j } t j t  } t j | | |  |  j d | j	    | j
   t j t  } t j |  } | j | |  |  j d | j	    | j
   d  S(   NRU   s   0.0(   R-   R_   R`   RU   R
   Ra   RJ   t   PrintFieldValueR   Rc   Rd   Re   (   R   R4   R5   Rf   Rg   Rh   Ri   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintFieldValue  s    	
c         C   sw   | j    } t j |  t j |  } | j    } t j | |  |  j | |  | t k rs t j |  |  n  d  S(   N(	   R-   R   t   SetAllFieldsR
   R3   RK   R   R   t   ExpectAllFieldsSet(   R   R4   R5   t
   ascii_textRN   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseAllFields"  s    c         C   s=  | j    } t j |  t j |  } | j d  } | j    } t j | |  |  j | |  | t k r t j	 |  |  n  | j
   t j | |  |  j | |  | t k r t j	 |  |  n  t j r9| j    } d } t j | |  |  j | j d  | j
   t j | |  |  j | j d  n  d  S(   Ns   utf-8u   optional_string: "café"u   café(   R-   R   Rm   R
   R3   t   encodeRK   R   R   Rn   t   Cleart   MergeR8   t   PY2RF   (   R   R4   R5   Ro   RN   t   msg2R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseAndMergeUtf8-  s,    
	
c         C   s   | j    } d } t j | |  |  j d | j d  |  j d | j d  |  j d | j d  |  j d | j d  |  j d | j d	  |  j d
 | j d  |  j d | j d  |  j d | j d	  |  j d | j d  d  S(   NsS  repeated_int64: -9223372036854775808
repeated_uint64: 18446744073709551615
repeated_double: 123.456
repeated_double: 1.23e+22
repeated_double: 1.23e-18
repeated_string: 
"\000\001\007\010\014\n\r\t\013\\\'\""
repeated_string: "foo" 'corge' "grault"
repeated_string: "\303\274\352\234\237"
repeated_string: "\xc3\xbc"
repeated_string: "ü"
l         i    l    gw/^@gtQFքDi   g6<i   s    
	\'"t   foocorgegraultu   üꜟu   üi   (   R-   R
   RK   R   R.   R0   R1   R2   (   R   R4   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseExoticH  s    c         C   s   | j    } d } t j | |  |  j d | j d  |  j d | j d  |  j d | j d  |  j d | j d  |  j d	 | j d  d  S(
   Nso   repeated_int64: 100;
repeated_int64: 200;
repeated_int64: 300,
repeated_string: "one",
repeated_string: "two";
id   i    i   i   i,  i   u   oneu   two(   R-   R
   RK   R   R.   R2   (   R   R4   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseTrailingCommasa  s    c         C   s   | j    } d } t j | |  |  j d | j d  |  j d | j d  |  j d | j d  |  j d | j d  |  j d	 | j d  d  S(
   NsR   repeated_int64: [100, 200];
repeated_int64: 300,
repeated_string: ["one", "two"];
id   i    i   i   i,  i   u   oneu   two(   R-   R
   RK   R   R.   R2   (   R   R4   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt"   testParseRepeatedScalarShortFormatp  s    c         C   s   | j    } d } t j | |  |  j d | j d j  |  j d | j d j  |  j d | j d j  |  j d | j d	 j  d  S(
   Nsy   repeated_nested_message: [{bb: 100}, {bb: 200}],
repeated_nested_message: {bb: 300}
repeated_nested_message [{bb: 400}];
id   i    i   i   i,  i   i  i   (   R-   R
   RK   R   R<   R>   (   R   R4   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt#   testParseRepeatedMessageShortFormat}  s    c         C   s<   | j    } d } t j | |  |  j | j    |  d  S(   NR   (   R-   R
   RK   R   (   R   R4   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseEmptyText  s    c         C   ss   | j    } d } |  j t j   } t j | |  Wd  QX|  j | j j   d  |  j | j j   d  d  S(   Ns   repeated_string: "\xc3\xc3"i   i   (	   R-   t   assertRaisesR
   t
   ParseErrorRK   R   t	   exceptiont   GetLinet	   GetColumn(   R   R4   R5   R!   t   e(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseInvalidUtf8  s    c         C   s8   | j    } d } t j |  t j d t j | |  d  S(   Nt   foos?   1:1 : Message type "\w+.TestAllTypes" has no field named "foo".(   R-   R8   t   assertRaisesRegexR
   R~   RK   (   R   R4   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseSingleWord  s
    c         C   s8   | j    } d } t j |  t j d t j | |  d  S(   Ns   unknown_field: 8
sI   1:1 : Message type "\w+.TestAllTypes" has no field named "unknown_field".(   R-   R8   R   R
   R~   RK   (   R   R4   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseUnknownField  s
    c         C   s8   | j    } d } t j |  t j d t j | |  d  S(   Ns   optional_nested_enum: BARRsG   1:23 : Enum type "\w+.TestAllTypes.NestedEnum" has no value named BARR.(   R-   R8   R   R
   R~   RK   (   R   R4   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseBadEnumValue  s    c         C   s8   | j    } d } t j |  t j d t j | |  d  S(   Ns   optional_int32: borks#   1:17 : Couldn't parse integer: bork(   R-   R8   R   R
   R~   RK   (   R   R4   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseBadIntValue  s
    c         C   s   | j    } d } t j | |  d } |  j d | j d  |  j | d | d | j d  |  j | d | d	 | j d
  |  j | | d | | d | j d  |  j | | d | | d	 | j d  |  j | d | j d  d  S(   Ns   repeated_string: "\xf\x62"
               repeated_string: "\\xf\\x62"
               repeated_string: "\\\xf\\\x62"
               repeated_string: "\\\\xf\\\\x62"
               repeated_string: "\\\\\xf\\\\\x62"
               repeated_string: "\x5cx20"s   \s   bi    t   xft   x62i   s   t   bi   i   i   t   x20i   (   R-   R
   RK   R   R2   (   R   R4   R5   R!   t   SLASH(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseStringFieldUnescape  s    ##c         C   sK   | j    } d } t j | |  } |  j | |  |  j d | j  d  S(   Ns%   optional_int32: 42 optional_int32: 67iC   (   R-   R
   Rs   RL   R   t   optional_int32(   R   R4   R5   R!   RO   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testMergeDuplicateScalars  s
    c         C   sQ   | j    } d } t j | |  } |  j | | k  |  j d | j j  d  S(   NsC   optional_nested_message { bb: 1 } optional_nested_message { bb: 2 }i   (   R-   R
   Rs   t
   assertTrueR   t   optional_nested_messageR>   (   R   R4   R5   R!   RO   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt&   testMergeDuplicateNestedMessageScalars  s
    c         C   sW   | j    } d | _ | j    } t j t j |  |  |  j d | j d   d  S(   Ni   t   oneof_uint32t   oneof_field(   R-   R   R
   RK   R3   R   t
   WhichOneof(   R   R4   t   mt   m2(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseOneof  s
    	c         C   sN   d j  d d g  } | j   } t j | |  |  j d | j d   d  S(   Ns   
s   oneof_uint32: 11s   oneof_string: "foo"t   oneof_stringR   (   R    R-   R
   Rs   R   R   (   R   R4   t   m_stringR   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testMergeMultipleOneof  s    c         C   sQ   d j  d d g  } | j   } |  j t j d   t j | |  Wd  QXd  S(   Ns   
s   oneof_uint32: 11s   oneof_string: "foo"s    is specified along with field (   R    R-   t   assertRaisesRegexpR
   R~   RK   (   R   R4   R   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseMultipleOneof  s
    
(    R   R   R6   R:   RA   RE   RG   RH   RP   RQ   R[   R^   Rj   Rl   Rp   Rv   Rx   Ry   Rz   R{   R|   R   R   R   R   R   R   R   R   R   R   R   (    (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyR,   e   s<   								
	!																				t    OnlyWorksWithProto2RightNowTestsc           B   sP   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   c         C   sE   t  j   } t j |  |  j |  j t j | d t  d  d  S(   Nt   pointy_bracketss*   text_format_unittest_data_pointy_oneof.txt(	   R   R-   R   Rm   R#   R+   R
   R3   R?   (   R   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintAllFieldsPointy  s    c         C   ss   d j  |  j d   } t j   } t j | |  } |  j | |  t j   } t j |  |  j	 | |  d  S(   Ns   
s/   text_format_unittest_data_oneof_implemented.txt(
   R    R   R   R-   R
   RK   RL   R   Rm   R   (   R   R$   RN   RO   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseGolden  s    c         C   s?   t  j   } t j |  |  j |  j t j |   d  d  S(   Ns/   text_format_unittest_data_oneof_implemented.txt(   R   R-   R   Rm   R#   R+   R
   R3   (   R   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintAllFields  s
    c         C   s   t  j   } d | _ d | _ d | _ d | j _ d | j _ |  j |  j	 t
 j | d t  d  |  j |  j	 t
 j |   d  d  S(	   Nt   115ie   io   i    i   t   use_index_ordersW   my_string: "115"
my_int: 101
my_float: 111
optional_nested_message {
  oo: 0
  bb: 1
}
sW   my_int: 101
my_string: "115"
my_float: 111
optional_nested_message {
  bb: 1
  oo: 0
}
(   R   t   TestFieldOrderingst	   my_stringt   my_intt   my_floatR   t   ooR>   R%   R+   R
   R3   R?   (   R   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintInIndexOrder  s    			c         C   sj   |  j  d  } t j   } t j | |  } |  j | |  t j   } t j |  |  j | |  d  S(   Ns/   text_format_unittest_data_oneof_implemented.txt(	   R   R   R-   R
   t
   MergeLinesRL   R   Rm   R   (   R   t   openedRN   RO   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testMergeLinesGolden  s    c         C   sj   |  j  d  } t j   } t j | |  } |  j | |  t j   } t j |  |  j | |  d  S(   Ns/   text_format_unittest_data_oneof_implemented.txt(	   R   R   R-   R
   t
   ParseLinesRL   R   Rm   R   (   R   R   RN   RO   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseLinesGolden'  s    c         C   sz   t  j   } d | j d <d | j d <d | j d <d | j d <d | j d	 <d
 | j d _ |  j	 t
 j |  d  d  S(   Ni8ii   i"   i!   i  i{   t   123t   abci   io   sH  map_int32_int32 {
  key: -123
  value: -456
}
map_int64_int64 {
  key: -8589934592
  value: -17179869184
}
map_uint32_uint32 {
  key: 123
  value: 456
}
map_uint64_uint64 {
  key: 8589934592
  value: 17179869184
}
map_string_string {
  key: "abc"
  value: "123"
}
map_int32_foreign_message {
  key: 111
  value {
    c: 5
  }
}
l        l     l        l     l        l        (   R   t   TestMapt   map_int32_int32t   map_int64_int64t   map_uint32_uint32t   map_uint64_uint64t   map_string_stringt   map_int32_foreign_messageR]   R%   R
   R3   (   R   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintMap1  s    c         C   s   t  j   } x% t j d d !D] } d | j | <q Wx+ t t j d d ! D] } d | j | <qK Wd j d   t j D  } |  j t j	 |  |  d  S(   Ni   i   t   dummyi    R   c         s   s   |  ] } d  | f Vq d S(   s3   map_string_string {
  key: "%c"
  value: "dummy"
}
N(    (   t   .0t   letter(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pys	   <genexpr>_  s   (
   R   R   t   stringt   ascii_uppercaseR   t   reversedR    R%   R
   R3   (   R   R5   R   t   golden(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testMapOrderEnforcementY  s    (
   R   R   R   R   R   R   R   R   R   R   (    (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyR     s   					
	
	(t   Proto2Testsc           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 RS(   c         C   s   t  j   } t  j j } t  j j } d | j j | _ d | j j | _ |  j	 t
 j |  d  t j   } t j } d | j | _ |  j	 t
 j |  d  d  S(   Ni   R   s   message_set {
  [protobuf_unittest.TestMessageSetExtension1] {
    i: 23
  }
  [protobuf_unittest.TestMessageSetExtension2] {
    str: "foo"
  }
}
t   barsF   [google.protobuf.internal.TestMessageSetExtension3] {
  text: "bar"
}
(   R   t   TestMessageSetContainert   TestMessageSetExtension1t   message_set_extensiont   TestMessageSetExtension2t   message_sett
   Extensionst   iR   R%   R
   R3   R   t   TestMessageSett   message_set_extension3R!   (   R   R5   t   ext1t   ext2t   ext(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintMessageSetv  s    		c         C   s   t  j t  } t j   } t j j } t j j } d | j j	 | _
 d | j j	 | _ t  j | | d t |  j | j   d  | j   d  S(   Ni   R   t   use_field_numbers?   1 {
  1545008 {
    15: 23
  }
  1547769 {
    25: "foo"
  }
}
(   R
   Ra   RJ   R   R   R   R   R   R   R   R   R   t   PrintMessageR?   R%   Rc   Rd   (   R   Rh   R5   R   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt    testPrintMessageSetByFieldNumber  s    c         C   sm   t  j   } t  j j } t  j j } d | j j | _ d | j j | _ |  j	 t
 j | d t d  d  S(   Ni   R   R;   s   message_set { [protobuf_unittest.TestMessageSetExtension1] { i: 23 } [protobuf_unittest.TestMessageSetExtension2] { str: "foo" } }(   R   R   R   R   R   R   R   R   R   R%   R
   R3   R?   (   R   R5   R   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintMessageSetAsOneLine  s    c         C   s   t  j   } d } t j | |  |  j d | j d  |  j d | j d  t j   } d } t j | |  t j j	 } t j
 j	 } |  j d | j j | j  |  j d | j j | j  d  S(   Ns&   repeated_uint64: 1
repeated_uint64: 2
i   i    i   s   message_set {
  [protobuf_unittest.TestMessageSetExtension1] {
    i: 23
  }
  [protobuf_unittest.TestMessageSetExtension2] {
    str: "foo"
  }
}
i   R   (   R   R-   R
   RK   R   R0   R   R   R   R   R   R   R   R   R   (   R   R5   R!   R   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseMessageSet  s    c         C   sW   t  j   } d } t j | | d t j   |  j t j | d t j   |  d  S(   Ns   value {
  [type.googleapis.com/google.protobuf.internal.TestAny] {
    [google.protobuf.internal.TestAnyExtension1.extension1] {
      i: 10
    }
  }
}
R	   (   t   test_extend_anyt   TestAnyR
   Rs   R	   t   DefaultR%   R3   (   R   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testExtensionInsideAnyMessage  s    c      	   C   s6  t  j   } d } t j | | d t |  j d | j d  |  j d | j d  t j   } d } t j | | d t t j	 j
 } t j j
 } |  j d | j j | j  |  j d | j j | j  t  j   } d	 } t j |  t j d
 t j | |  d } t j |  t j d t j | | d t d  S(   Ns   34: 1
repeated_uint64: 2
t   allow_field_numberi   i    i   s?   1 {
  1545008 {
    15: 23
  }
  1547769 {
    25: "foo"
  }
}
i   R   s   34:1
s>   1:1 : Message type "\w+.TestAllTypes" has no field named "34".s   1234:1
s@   1:1 : Message type "\w+.TestAllTypes" has no field named "1234".(   R   R-   R
   RK   R?   R   R0   R   R   R   R   R   R   R   R   R   R8   R   R~   (   R   R5   R!   R   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseMessageByFieldNumber  s4    c         C   s?   t  j   } t j |  |  j |  j t j |   d  d  S(   Ns(   text_format_unittest_extensions_data.txt(   R   t   TestAllExtensionsR   t   SetAllExtensionsR#   R+   R
   R3   (   R   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintAllExtensions   s
    c         C   sE   t  j   } t j |  |  j |  j t j | d t  d  d  S(   NR   s/   text_format_unittest_extensions_data_pointy.txt(	   R   R   R   R   R#   R+   R
   R3   R?   (   R   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintAllExtensionsPointy  s    c         C   sa   d j  |  j d   } t j   } t j | |  t j   } t j |  |  j | |  d  S(   Ns   
s(   text_format_unittest_extensions_data.txt(	   R    R   R   R   R
   RK   R   R   R   (   R   R$   RN   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseGoldenExtensions  s    c         C   sX   t  j   } t j |  t j |  } t  j   } t j | |  |  j | |  d  S(   N(   R   R   R   R   R
   R3   RK   R   (   R   R5   Ro   RN   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseAllExtensions  s    c      	   C   s  t  j   } d } t j | | d t d } |  j t j |  |  t  j   } d } t j |  t j	 d t j | | d t t  j   } d } t j |  t j	 d t j | | d t t  j   } d } t j |  t j	 d t j | | d t t  j   } d	 } t j |  t j	 d
 t j | | d t t  j   } d } t j |  t j	 d t j | | d t t  j   } d } t j | | d t t  j
 j } t  j j } |  j d | j j | j  |  j d | j j | j  d  S(   Ns  message_set {
  [unknown_extension] {
    i: 23
    bin: ""    [nested_unknown_ext]: {
      i: 23
      x: x
      test: "test_string"
      floaty_float: -0.315
      num: -inf
      multiline_str: "abc"
          "def"
          "xyz."
      [nested_unknown_ext.ext]: <
        i: 23
        i: 24
        pointfloat: .3
        test: "test_string"
        floaty_float: -0.315
        num: -inf
        long_string: "test" "test2" 
      >
    }
  }
  [unknown_extension]: 5
}
t   allow_unknown_extensions   message_set {
}
s3   message_set {
  [unknown_extension] {
    i:
  }
}
s   Invalid field value: }sG   message_set {
  [unknown_extension] {
    str: "malformed string
  }
}
s   Invalid field value: "sS   message_set {
  [unknown_extension] {
    str: "malformed
 multiline
 string
  }
}
s7   message_set {
  [malformed_extension] <
    i: -5
  
}
s   5:1 : Expected ">".s)   message_set {
  unknown_field: true
  
}
sb   2:3 : Message type "proto2_wireformat_unittest.TestMessageSet" has no field named "unknown_field".s   message_set {
  [protobuf_unittest.TestMessageSetExtension1] {
    i: 23
  }
  [protobuf_unittest.TestMessageSetExtension2] {
    str: "foo"
  }
}
i   R   (   R   R   R
   RK   R?   R%   R3   R8   R   R~   R   R   R   R   R   R   R   R   (   R   R5   R!   R   t	   malformedR   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt    testParseAllowedUnknownExtension"  sr    					c         C   sZ   t  j   } d } |  j t j   } t j | |  Wd  QX|  j t | j  d  d  S(   Ns#   optional_nested_message { "bb": 1 }s/   1:27 : Expected identifier or number, got "bb".(	   R   R-   R}   R
   R~   RK   R   R   R   (   R   R5   R!   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseBadIdentifier  s    c         C   sf   t  j   } d } t j |  t j d t j | |  t  j   } t j |  t j d t j | |  d  S(   Ns   [unknown_extension]: 8
s3   1:2 : Extension "unknown_extension" not registered.sM   1:2 : Message type "protobuf_unittest.TestAllTypes" does not have extensions.(   R   R   R8   R   R
   R~   RK   R-   (   R   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseBadExtension  s    c         C   s8   t  j   } d } t j |  t j d t j | |  d  S(   Ns   optional_nested_enum: 100sL   1:23 : Enum type "\w+.TestAllTypes.NestedEnum" has no value with number 100.(   R   R-   R8   R   R
   R~   RK   (   R   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseNumericUnknownEnum  s    c         C   s@   t  j   } d } t j | |  |  j d | j t  j  d  S(   Nsa   [protobuf_unittest.optional_int32_extension]: 42 [protobuf_unittest.optional_int32_extension]: 67iC   (   R   R   R
   Rs   R   R   t   optional_int32_extension(   R   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt"   testMergeDuplicateExtensionScalars  s
    	c         C   s8   t  j   } d } t j |  t j d t j | |  d  S(   Nsa   [protobuf_unittest.optional_int32_extension]: 42 [protobuf_unittest.optional_int32_extension]: 67s   1:96 : Message type "protobuf_unittest.TestAllExtensions" should not have multiple "protobuf_unittest.optional_int32_extension" extensions.(   R   R   R8   R   R
   R~   RK   (   R   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt"   testParseDuplicateExtensionScalars  s
    c         C   s8   t  j   } d } t j |  t j d t j | |  d  S(   NsC   optional_nested_message { bb: 1 } optional_nested_message { bb: 2 }sh   1:65 : Message type "protobuf_unittest.TestAllTypes.NestedMessage" should not have multiple "bb" fields.(   R   R-   R8   R   R
   R~   RK   (   R   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt&   testParseDuplicateNestedMessageScalars  s    	c         C   s8   t  j   } d } t j |  t j d t j | |  d  S(   Ns%   optional_int32: 42 optional_int32: 67sf   1:36 : Message type "protobuf_unittest.TestAllTypes" should not have multiple "optional_int32" fields.(   R   R-   R8   R   R
   R~   RK   (   R   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseDuplicateScalars  s    	c         C   s`   t  j   } d } t j |  t j d t j | |  d } t j |  t j d t j | |  d  S(   Ns   RepeatedGroup: <s   1:16 : Expected ">".s   RepeatedGroup: {s   1:16 : Expected "}".(   R   R-   R8   R   R
   R~   RK   (   R   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseGroupNotClosed  s    c         C   s~   t  j   } d } t j | |  |  j | j d   | j   t  j   } d } t j | |  |  j | j d   d  S(   Ns   OptionalGroup: {}t   optionalgroups   OptionalGroup: <>(   R   R-   R
   RK   R   t   HasFieldRr   (   R   R5   R!   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseEmptyGroup  s    
c         C   s   d } t  j   } t j | |  |  j d | j d  |  j d | j d  |  j d | j d  |  j d | j d  |  j d	 | j	 d
  |  j d | j
 d j  d  S(   NsH  map_int32_int32 {
  key: -123
  value: -456
}
map_int64_int64 {
  key: -8589934592
  value: -17179869184
}
map_uint32_uint32 {
  key: 123
  value: 456
}
map_uint64_uint64 {
  key: 8589934592
  value: 17179869184
}
map_string_string {
  key: "abc"
  value: "123"
}
map_int32_foreign_message {
  key: 111
  value {
    c: 5
  }
}
i8ii   i"   i!   i  i{   R   R   i   io   l        l     l        l     l        l        (   R   R   R
   RK   R   R   R   R   R   R   R   R]   (   R   R!   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testParseMap  s    (   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyR   t  s*   						)			
			z					
						t   Proto3Testsc           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 RS(   c         C   sZ   t  j   } d | _ t j   } | j j |  |  j t j	 | d t
 j   d  d  S(   NR   R	   s[   any_value {
  [type.googleapis.com/protobuf_unittest.OneString] {
    data: "string"
  }
}
(   R   t	   OneStringt   dataR   R   t	   any_valuet   PackR   R
   R3   R	   R   (   R   t   packed_messageR5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrintMessageExpandAny  s    	c         C   ss   t  j   } t j   } d | _ | j j   j |  d | _ | j j   j |  |  j t	 j
 |  d  d  S(   Nt   string0t   string1s   repeated_any_value {
  [type.googleapis.com/protobuf_unittest.OneString] {
    data: "string0"
  }
}
repeated_any_value {
  [type.googleapis.com/protobuf_unittest.OneString] {
    data: "string1"
  }
}
(   R   R   R   R   R   t   repeated_any_valueR=   R   R   R
   R3   (   R   R   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt!   testPrintMessageExpandAnyRepeated(  s    		c         C   s`   t  j   } d | _ t j   } | j j |  t j   } |  j	 t
 j | d | d  d  S(   NR   R	   sd   any_value {
  type_url: "type.googleapis.com/protobuf_unittest.OneString"
  value: "\n\006string"
}
(   R   R   R   R   R   R   R   R	   t   DescriptorPoolR   R
   R3   (   R   R   R5   t
   empty_pool(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt2   testPrintMessageExpandAnyDescriptorPoolMissingType<  s    	c         C   sT   t  j   } d | _ t j   } | j j |  |  j t j	 | d t
 d  d  S(   NR   R   s[   any_value <
  [type.googleapis.com/protobuf_unittest.OneString] <
    data: "string"
  >
>
(   R   R   R   R   R   R   R   R   R
   R3   R?   (   R   R   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt'   testPrintMessageExpandAnyPointyBracketsI  s    	c         C   sT   t  j   } d | _ t j   } | j j |  |  j t j	 | d t
 d  d  S(   NR   R;   sR   any_value { [type.googleapis.com/protobuf_unittest.OneString] { data: "string" } }(   R   R   R   R   R   R   R   R   R
   R3   R?   (   R   R   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt"   testPrintMessageExpandAnyAsOneLineW  s    	c      	   C   sf   t  j   } d | _ t j   } | j j |  |  j t j	 | d t
 d t
 d t j   d  d  S(   NR   R;   R   R	   sR   any_value < [type.googleapis.com/protobuf_unittest.OneString] < data: "string" > >(   R   R   R   R   R   R   R   R   R
   R3   R?   R	   R   (   R   R   R5   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt0   testPrintMessageExpandAnyAsOneLinePointyBracketsd  s    	c         C   sW   t  j   } t  j   } d | _ t j |  } t j | |  |  j d | j  d  S(   Ni  (   R   R-   t   optional_nested_enumR
   R3   RK   R   (   R   R5   t   message2t   text_string(    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testUnknownEnumss  s    	c         C   s   t  j   } d } t j | |  t j   } | j j |  |  j d | j	  | j
   t j | |  t j   } | j j |  |  j d | j	  d  S(   Ns[   any_value {
  [type.googleapis.com/protobuf_unittest.OneString] {
    data: "string"
  }
}
R   (   R   R   R
   Rs   R   R   R   t   UnpackR   R   Rr   RK   (   R   R5   R!   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testMergeExpandedAny{  s    
c         C   s   t  j   } d } t j | |  t j   } | j d j |  |  j d | j	  | j d j |  |  j d | j	  d  S(   Ns   repeated_any_value {
  [type.googleapis.com/protobuf_unittest.OneString] {
    data: "string0"
  }
}
repeated_any_value {
  [type.googleapis.com/protobuf_unittest.OneString] {
    data: "string1"
  }
}
i    R   i   R   (
   R   R   R
   Rs   R   R   R   R	  R   R   (   R   R5   R!   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testMergeExpandedAnyRepeated  s    
c         C   sU   t  j   } d } t j | |  t j   } | j j |  |  j d | j	  d  S(   Ns[   any_value {
  [type.googleapis.com/protobuf_unittest.OneString] <
    data: "string"
  >
}
R   (
   R   R   R
   Rs   R   R   R   R	  R   R   (   R   R5   R!   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt"   testMergeExpandedAnyPointyBrackets  s    c         C   sH   t  j   } d } t j | |  t j   } |  j d | j j  d  S(   NsY   any_value {
  [type.otherapi.com/protobuf_unittest.OneString] {
    data: "string"
  }
}
s-   type.otherapi.com/protobuf_unittest.OneString(	   R   R   R
   Rs   R   R   R   R   t   type_url(   R   R5   R!   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testMergeAlternativeUrl  s    	c      	   C   sl   t  j   } d } |  j t j  ) } t j   } t j | | d | Wd  QX|  j t	 | j
  d  d  S(   Ns[   any_value {
  [type.googleapis.com/protobuf_unittest.OneString] {
    data: "string"
  }
}
R	   s=   Type protobuf_unittest.OneString not found in descriptor pool(   R   R   R}   R
   R~   R	   R   Rs   R   R   R   (   R   R5   R!   R   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt-   testMergeExpandedAnyDescriptorPoolMissingType  s    c         C   sU   d } t  j   } t j | |  t j   } | j j |  |  j d | j	  d  S(   Nsd   any_value {
  type_url: "type.googleapis.com/protobuf_unittest.OneString"
  value: "\n\006string"
}
R   (
   R   R   R
   Rs   R   R   R   R	  R   R   (   R   R!   R5   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testMergeUnexpandedAny  s    c         C   sZ   t  j   } d } |  j t j   } t j | |  Wd  QX|  j t | j  d  d  S(   NsU   any_value {
  [type.googleapis.com/protobuf_unittest.OneString] {
    data: "string"
s   3:11 : Expected "}".(	   R   R   R}   R
   R~   Rs   R   R   R   (   R   R5   R!   R   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testMergeMissingAnyEndToken  s
    (   R   R   R   R   R  R  R  R  R  R
  R  R  R  R  R  R  (    (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyR     s   													t   TokenizerTestc           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 RS(   c      T   C   s  d } t  j | j    } | j d f d | j d f | j d f d | j d f | j d f d | j d f | j d	 f d | j d
 f | j d f d | j d f | j d f d | j d f | j d f d | j d f | j d f d d | j d f d | j t d  f | j d f d | j t d  f | j d f d | j t	 f | j d f d | j t
 f d | j d f d | j d f | j d f d | j d f | j d f d | j d f | j d f d | j d  f | j d! f d | j d" f | j d# f d | j d$ f | j d% f d | j t
 f | j d& f d | j t	 f | j d' f d | j t	 f | j d( f d | j t
 f | j d) f d | j t
 f | j d* f d | j t	 f | j d+ f d | j t d  f | j d, f d | j t d-  f | j d. f d | j t d/  f gR } d0 } x | j   s| | } t | t  rg| j } |  j | |  | j   na t | d1 t  rt j | d1  r|  j t j | d0     n |  j | d1 | d0    | d1 7} qWd  S(2   Ns  identifier1:"string1"
     

identifier2 : 
 
123  
  identifier3 :'string'
identifiER_4 : 1.1e+2 ID5:-0.23 ID6:'aaaa\'bbbb'
ID7 : "aa\"bb"



 ID8: {A:inf B:-inf C:true D:false}
ID9: 22 ID10: -111111111111111111 ID11: -22
ID12: 2222222222222222222 ID13: 1.23456f ID14: 1.2e+2f false_bool:  0 true_BOOL:t 
 true_bool1:  1 false_BOOL1:f False_bool: False True_bool: True X:iNf Y:-inF Z:nANt   identifier1t   :R   t   identifier2i{   t   identifier3R   t   identifiER_4g     [@t   ID5gq=
ףpͿt   ID6s	   aaaa'bbbbt   ID7s   aa"bbt   ID8t   {t   At   inft   Bt   Ct   Dt   }t   ID9i   t   ID10lq{Ut   ID11it   ID12l   c/Y-v t   ID13g82?t   ID14g      ^@t
   false_boolt	   true_BOOLt
   true_bool1t   false_BOOL1t
   False_boolt	   True_boolt   Xt   Ys   -inft   Zt   nani    i   (   R
   t	   Tokenizert
   splitlinest   ConsumeIdentifiert   ConsumeStringt   ConsumeIntegert   ConsumeFloatt   floatt   ConsumeBoolR?   RJ   t   AtEndt
   isinstanceR   t   tokenR   t	   NextTokent   matht   isnanR   (   R   R!   t	   tokenizert   methodsR   R   R=  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testSimpleTokenCases  s    
	& c         C   sY  d
 } d } d | d | d f } t  j | j    } |  j d | j    |  j | d | j    |  j | d | j    |  j | j    d } t  j | j    } |  j d | j    |  j d | j    |  j t | j    |  j t	 | j    |  j
 t  j   | j   Wd  QX|  j d | j    |  j | j    d  S(   Ni   i?   i    s   -1 %d %dis
   -0 0 0 1.2i    g333333?l            l    l        l    (   R
   R3  R4  R   R7  R   R;  R?   t   TryConsumeIntegerRJ   R}   R~   R8  (   R   t	   int64_maxt
   uint32_maxR!   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testConsumeAbstractIntegers)  s$    c         C   s  d	 } d } d | d | d f } t  j | j    } |  j t  j t  j |  |  j t  j t  j |  |  j d t  j |   |  j t  j t  j |  |  j t  j t  j |  |  j | d t  j	 |   |  j t  j t  j	 |  |  j | d t  j |   |  j
 | j    d } t  j | j    } |  j d t  j |   |  j d t  j |   |  j d t  j |   |  j d t  j |   |  j
 | j    d  S(   Ni   i?   i    s   -1 %d %dis	   -0 -0 0 0i    l            l    l        l    (   R
   R3  R4  R}   R~   t   _ConsumeUint32t   _ConsumeUint64R   t   _ConsumeInt32t   _ConsumeInt64R   R;  (   R   RE  RF  R!   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testConsumeIntegersB  s2    c         C   s   d } t  j | j    } |  j t  j | j  d } t  j | j    } |  j t  j | j  d } t  j | j    } |  j t  j | j  d } t  j | j    } |  j t  j | j  d } t  j | j    } |  j t  j | j  d  S(   Ns	   "string1's   string1"s   
"\xt"s   
"\"s   
"\x"(   R
   R3  R4  R}   R~   t   ConsumeByteString(   R   R!   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testConsumeByteStringb  s    c         C   s5   d } t  j | j    } |  j t  j | j  d  S(   Ns
   not-a-bool(   R
   R3  R4  R}   R~   R:  (   R   R!   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testConsumeBoolw  s    c         C   sB   t  j d j    } |  j | j    |  j t  j | j  d  S(   Ns   # some comment(   R
   R3  R4  R   R;  R}   R~   t   ConsumeComment(   R   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testSkipComment|  s    c         C   s[   t  j d j   d t } |  j | j    |  j d | j    |  j | j    d  S(   Ns   # some commentt   skip_comments(	   R
   R3  R4  RJ   t   assertFalseR;  R   RP  R   (   R   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testConsumeComment  s
    	c         C   sw   d } t  j | j   d t } |  j d | j    |  j | j    |  j d | j    |  j | j    d  S(   Ns    # some comment
# another commentRR  s   # some comments   # another comment(	   R
   R3  R4  RJ   R   RP  RS  R;  R   (   R   R!   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testConsumeTwoComments  s    c         C   s   d } t  j | j   d t } |  j t  j | j  |  j d | j    |  j | j	 d  | j
   |  j t  j | j  |  j d | j    |  j | j    |  j d | j    |  j | j    d  S(   Ns   some_number: 4
# some commentRR  t   some_numberR  i   s   # some comment(   R
   R3  R4  RJ   R}   R~   RP  R   R5  R=  R>  R7  RS  R;  R   (   R   R!   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testConsumeTrailingComment  s    
c         C   sa   t  j d j   d t } |  j | j    |  j t d f | j    |  j | j    d  S(   Ns   # some commentRR  (	   R
   R3  R4  RJ   RS  R;  R   t   ConsumeCommentOrTrailingCommentR   (   R   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testConsumeLineComment  s    	c         C   s   d } t  j | j   d t } |  j t d f | j    |  j | j    |  j t d f | j    |  j | j    d  S(   Ns    # some comment
# another commentRR  s   # some comments   # another comment(	   R
   R3  R4  RJ   R   RX  RS  R;  R   (   R   R!   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testConsumeTwoLineComments  s    c         C   s   d } t  j | j   d t } |  j t  j | j  |  j d | j    |  j | j	 d  | j
   |  j t  j | j  |  j d | j    |  j | j    |  j t d f | j    |  j | j    d  S(   Ns   some_number: 4  # some commentRR  RV  R  i   s   # some comment(   R
   R3  R4  RJ   R}   R~   RX  R   R5  R=  R>  R7  RS  R;  R?   R   (   R   R!   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt"   testConsumeAndCheckTrailingComment  s    


c         C   s   d } t  j | j   d t } |  j d | j    |  j | j d  | j   |  j d | j    |  j t	 d f | j
    |  j | j    d  S(   Ns2   some_number: 4  # some comment # not a new commentRR  RV  R  i   s"   # some comment # not a new comment(   R
   R3  R4  RJ   R   R5  R=  R>  R7  R?   RX  R   R;  (   R   R!   RA  (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testHashinComment  s    
(   R   R   RC  RG  RL  RN  RO  RQ  RT  RU  RW  RY  RZ  R[  R\  (    (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyR    s   	M		 								
	t   PrettyPrinterTestc           B   s5   e  Z d    Z d   Z d   Z d   Z d   Z RS(   c         C   sV   d   } | j    } | j j   } d | _ |  j t j | d t d | d  d  S(   Nc         S   s   ~  ~ ~ d  S(   N(   t   None(   R5   t   indentR;   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyRi     s    	i*   R;   t   message_formatters"   repeated_nested_message { bb: 42 }(   R-   R<   R=   R>   R%   R
   R3   R?   (   R   R4   Ri   R5   R@   (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrettyPrintNoMatch  s    		c            s\     f d   }   j    } | j j   } d | _ |  j t j | d t d | d  d  S(   Nc            s-   ~ ~ |  j    j j j  k r) d |  j Sd  S(   Ns   My lucky number is %s(   R_   R-   t   NestedMessageR>   (   R   R_  R;   (   R4   (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyRi     s    i*   R;   R`  s1   repeated_nested_message { My lucky number is 42 }(   R-   R<   R=   R>   R%   R
   R3   R?   (   R   R4   Ri   R5   R@   (    (   R4   sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrettyPrintOneLine  s    	c            s     f d   }   j    } | j j   } d | _ |  j t j | d t d | d  |  j t j | d t d | d  d  S(   Nc            sG   |  j    j j j  k rC | r$ d n d d | } d | |  j f Sd  S(   Nt    s   
s   My lucky number is:%s%s(   R_   R-   Rb  R>   R^  (   R   R_  R;   t   line_deliminator(   R4   (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyRi     s    i*   R;   R`  s2   repeated_nested_message { My lucky number is: 42 }s7   repeated_nested_message {
  My lucky number is:
  42
}
(	   R-   R<   R=   R>   R%   R
   R3   R?   RJ   (   R   R4   Ri   R5   R@   (    (   R4   sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrettyPrintMultiLine  s    	c            si     f d   }   j    } |  j t j | d t d | d  |  j t j | d t d | d  d  S(   Nc            s#   ~ ~ |  j    j j  k r d Sd  S(   Ns   The is the message!(   R_   R-   R^  (   R   R_  R;   (   R4   (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyRi     s    R;   R`  s   The is the message!
s   The is the message!(   R-   R%   R
   R3   RJ   R?   (   R   R4   Ri   R5   (    (   R4   sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrettyPrintEntireMessage  s    c            s     f d   }   j    } d | _ | j j   } d | _ | j j   } d | _ | j } d | _ |  j t j | d t	 d | d  d  S(	   Nc            s-   ~ ~ |  j    j j j  k r) d |  j Sd  S(   Ns   My lucky number is %s(   R_   R-   Rb  R>   R^  (   R   R_  R;   (   R4   (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyRi     s    i=   i*   ic   i   R;   R`  s   optional_int32: 61 optional_nested_message { My lucky number is 1 } repeated_nested_message { My lucky number is 42 } repeated_nested_message { My lucky number is 99 }(
   R-   R   R<   R=   R>   R   R%   R
   R3   R?   (   R   R4   Ri   R5   R@   (    (   R4   sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   testPrettyPrintMultipleParts  s    					(   R   R   Ra  Rc  Rf  Rg  Rh  (    (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyR]    s
   				t   __main__(#   t   __doc__t
   __author__R?  R'   R8   R   t	   unittest2t   unittestt   ImportErrort   google.protobuf.internalR    t   google.protobufR   R   R   R   R   R   R   R   R   R	   R
   t   TestCaseR   R   t
   ParametersR,   R   R   R   R  R]  R   t   main(    (    (    sM   /usr/lib/python2.7/site-packages/google/protobuf/internal/text_format_test.pyt   <module>!   sF     ]