AlkantarClanX12

Your IP : 3.147.53.90


Current Path : /lib/python2.7/site-packages/google/protobuf/internal/
Upload File :
Current File : //lib/python2.7/site-packages/google/protobuf/internal/message_test.pyc

�
Du�ac@s�dZdZddlZddlZddlZddlZddlZddlZddlZddl	Z	yddl
ZWnek
r�ddlZnXye
Wnek
r�d�Z
nXddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZej r�e!Z"nd�Z#d�Z$d�Z%d�Z&ej'Z'ej(defdef�de'fd��Y�Z)de'fd��YZ*de'fd��YZ+d e'fd!��YZ,d"e'fd#��YZ-ej.ej/�d$kp�ej0d%d&fkd'�d(e'fd)��Y�Z1e2d*kr�ej3�ndS(+s�Tests python protocol buffers against the golden message.

Note that the golden messages exercise every known field type, thus this
test ends up exercising and verifying nearly all of the parsing and
serialization code in the whole library.

TODO(kenton):  Merge with wire_format_test?  It doesn't make a whole lot of
sense to call this a test of the "message" module, which only declares an
abstract interface.
s!gps@google.com (Gregory P. Smith)i����NcCs||k||kS(N((txty((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt<lambda>>t(tmap_proto2_unittest_pb2(tmap_unittest_pb2(tunittest_pb2(tunittest_proto3_arena_pb2(tdescriptor_pb2(tdescriptor_pool(tmessage_factory(ttext_format(tapi_implementation(tencoder(tpacked_field_test_pb2(t	test_util(ttesting_refleaks(tmessage(t_parameterizedcCs
||kS(N((tval((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pytisnanVscCst|�ot|d�S(Ni(R(R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pytisinfYscCst|�o|dkS(Ni(R(R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pytIsPosInf\scCst|�o|dkS(Ni(R(R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pytIsNegInf^st_proto2t_proto3tMessageTestc
Bs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�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/dFe1d.d/d0d1e2�gie3�g
Z4d2�Z5d3�Z6d4�Z7d5�Z8d6�Z9d7�Z:d8�Z;d9e<fd:��YZ=d;�Z>d<�Z?d=�Z@d>�ZAd?�ZBd@�ZCdA�ZDdB�ZEdC�ZFdD�ZGdE�ZHRS(GcCsvtj�dkr"|jd�ntjd�}|jt��}|jj|�WdQX|j	dt
|j��dS(Ntpythons�Skipping testBadUtf8String, currently only the python api implementation raises UnicodeDecodeError when a string field contains bad utf-8.tbad_utf8_stringsTestAllTypes.optional_string(RtTypetskipTestRtGoldenFileDatatassertRaisestUnicodeDecodeErrortTestAllTypest
FromStringtassertIntstrt	exception(tselftmessage_modulet
bad_utf8_datatcontext((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestBadUtf8StringjscCs�|tkrtjd�}ntjd�}|j�}|j|�|tkretj||�n|j||j��tj	|�}|j||j��dS(Nt golden_message_oneof_implementedtgolden_message_proto3(
RRRR"tParseFromStringtExpectAllFieldsSettassertEqualtSerializeToStringtcopytdeepcopy(R'R(tgolden_datatgolden_messagetgolden_copy((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestGoldenMessagets
cCs�tjd�}|j�}|j|�|j�}tj|�|j||�|j||j��tj|�}|j||j��dS(Ntgolden_packed_fields_message(	RRtTestPackedTypesR.tSetAllPackedFieldsR0R1R2R3(R'R(R4R5tall_setR6((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestGoldenPackedMessage�s

c	Cs*|j�}|jt|jd�|jt|jd�tjdd�}tj�dkr�|jt	j
��}|j|�WdQX|jdt|j
��n�tjdt��r}tjd�|j|�t|�dks�t�t|d	jt�st�|jd
t|d	j	��WdQXdS(Nit0iiRsUnexpected end-group tag.trecordtalwaysi����s4Unexpected end-group tag: Not all data was converted(R"R t	TypeErrorR#t	ExceptionR
tTagBytesRRRtDecodeErrorR0R%R&twarningstcatch_warningstTruetsimplefiltertlentAssertionErrort
issubclasstcategorytRuntimeWarning(R'R(tmsgtend_tagR*tw((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestParseErrors�s

	cs�d}|j�}|jjddddg�|j||jdd��|j||jdt��|j||jdt��dtfd��Y�d	t	f�fd
��Y}|j
���|jd|��WdQXdS(Ns5�
One string�
Two string�
Red string�Blue strings
One strings
Two strings
Red stringsBlue stringt
deterministictBadArgErrorcBseZRS((t__name__t
__module__(((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyRR�stBadArgcs&eZ�fd�Z�fd�ZRS(cs
���dS(N((R'(RR(sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt__nonzero__�scs
���dS(N((R'(RR(sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt__bool__�s(RSRTRVRW((RR(sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyRU�s(R"trepeated_stringtextendR0R1tNonetFalseRFRAtobjectR (R'R(R4R5RU((RRsI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestDeterminismParameters�s"	
			cCsZtjd�}|j�}|j|�tj|�}tj|�}|j||�dS(NR5(RRR"R.tpickletdumpstloadsR0(R'R(R4R5tpickled_messagetunpickled_message((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestPickleSupport�s
cCs�|tkrd}nd}|j�}|j|�|jt|j��|jt|j��|jt|jd��|jt|jd��|j	||j
��dS(Ns]�a�����s ]�a�����i(RR"R.t
assertTrueRtoptional_floattoptional_doubletrepeated_floattrepeated_doubleR0R1(R'R(R4R5((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestPositiveInfinity�s	
cCs�|tkrd}nd}|j�}|j|�|jt|j��|jt|j��|jt|jd��|jt|jd��|j	||j
��dS(Ns]��a������s ]��a������i(RR"R.RdRReRfRgRhR0R1(R'R(R4R5((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestNegativeInfinity�s	
cCsd}|j�}|j|�|jt|j��|jt|j��|jt|jd��|jt|jd��|j�}|j�}|j|�|jt|j��|jt|j��|jt|jd��|jt|jd��dS(Ns]�a�����i(	R"R.RdRReRfRgRhR1(R'R(R4R5t
serializedR((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestNotANumber�s

cCsmd}|j�}|j|�|jt|jd��|jt|jd��|j||j��dS(Ns����i(R9R.RdRtpacked_floatt
packed_doubleR0R1(R'R(R4R5((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestPositiveInfinityPackeds
cCsmd}|j�}|j|�|jt|jd��|jt|jd��|j||j��dS(Ns�����i(R9R.RdRRmRnR0R1(R'R(R4R5((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestNegativeInfinityPackeds
cCs�d}|j�}|j|�|jt|jd��|jt|jd��|j�}|j�}|j|�|jt|jd��|jt|jd��dS(Ns����i(R9R.RdRRmRnR1(R'R(R4R5RkR((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestNotANumberPacked%s

cCs�|j�}tjdd�}||_|j|j��|j|j|k�dtjdd�}||_|j|j��|j|j|k�||_|j|j��|j|j|k�||_|j|j��|j|j|k�tjdd�}||_|j|j��|j|j|k�dtjdd�}||_|j|j��|j|j|k�||_|j|j��|j|j|k�||_|j|j��|j|j|k�dS(Niig�?i����(R"tmathtpowReR.R1Rd(R'R(RtkMostPosExponentNoSigBitstkMostPosExponentOneSigBittkMostNegExponentNoSigBitstkMostNegExponentOneSigBit((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtremeFloatValues3s:		

		

cCs�|j�}tjdd�}||_|j|j��|j|j|k�dtjdd�}||_|j|j��|j|j|k�||_|j|j��|j|j|k�||_|j|j��|j|j|k�tjdd�}||_|j|j��|j|j|k�dtjdd�}||_|j|j��|j|j|k�||_|j|j��|j|j|k�||_|j|j��|j|j|k�dS(Nii�g�?i���(R"RrRsRfR.R1Rd(R'R(RRtRuRvRw((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtremeDoubleValues`s:		

		

cCs/|j�}d|_|jt|�d�dS(Ng@soptional_float: 2.0
(R"ReR0R%(R'R(R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestFloatPrinting�s	cCsW|j�}d|_tjdkr=|jt|�d�n|jt|�d�dS(Ng^!�7ݚ�?is%optional_double: 0.12345678912345678
s optional_double: 0.123456789123
(i(R"Rftsystversion_infoR0R%(R'R(R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestHighPrecisionFloatPrinting�s
	cCsR|j�}tj|�|j�}|j|j��|jt|�d�dS(NR(R"RtSetAllNonLazyFieldstTestEmptyMessageR.R1R0R%(R'R(t	populatedtempty((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestUnknownFieldPrinting�s

cCs|j�}|jjdd�|jjdd�|jjdd�|jjdd�|jddddgg|jD]}|j^qw�|jddddggt|j�D]}|j^q��|jddddgg|jddd�D]}|j^q��dS(Ntbbiiiii����(R"trepeated_nested_messagetaddR0R�treversed(R'R(RMtm((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt testRepeatedNestedFieldIteration�s &cCs�|j�}|jjd�|jjd�|jjd�|jj�|j|jdd�|j|jdd�|j|jdd�|jt|j�tdddg��|jjd�|jjd�|jjd�|jj�|j|jdd�|j|jdd�|j|jdd�|jjd�|jjd	�|jjd
�|jj�|j|jdd�|j|jdd
�|j|jdd	�|jt|j�tddd
g��|j	jd�|j	jd	�|j	jd
�|j	j�|j|j	dd�|j|j	dd
�|j|j	dd	�|jt|j	�tdd
d	g��dS(s7Check some different types with the default comparator.iiiig�������?g�������?g333333�?tatctbuaubucN(
R"trepeated_int32tappendtsortR0R%RgtassertAlmostEqualRXtrepeated_bytes(R'R(R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt0testSortingRepeatedScalarFieldsDefaultComparator�s@
(

(
cCs |j�}|jjd�|jjd�|jjd�|jjdt�|j|jdd�|j|jdd�|j|jdd�|jjd�|jjd	�|jjd
�|jjdt�|j|jdd
�|j|jdd	�|j|jdd�dS(s2Check some different types with custom comparator.i����i����i����tkeyiiitaaaR�R�N(R"R�R�R�tabsR0RXRH(R'R(R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt/testSortingRepeatedScalarFieldsCustomComparator�scCsM|j�}d|jj�_d|jj�_d|jj�_d|jj�_d|jj�_d|jj�_|jjdtjd��|j|jd	jd�|j|jdjd�|j|jdjd�|j|jdjd�|j|jdjd�|j|jdjd�|jt|j�d
�dS(sECheck passing a custom comparator to sort a repeated composite field.iiiiiiR�R�is0[bb: 1
, bb: 2
, bb: 3
, bb: 4
, bb: 5
, bb: 6
]N(	R"R�R�R�R�toperatort
attrgetterR0R%(R'R(R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt2testSortingRepeatedCompositeFieldsCustomComparator�s cCsC|j�}d|jj�_d|jj�_d|jj�_d|jj�_d|jj�_d|jj�_d|jj�_|jjdd	��|jdddddddgg|jD]}|j^q��|j�}|j�|j|�|jdddddddgg|jD]}|j^q)�d
S(sECheck passing a custom comparator to sort a repeated composite field.iii
i!iii
R�cSs|jdS(Ni
(R�(tz((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyR
RN(	R"R�R�R�R�R0R1tCleartMergeFromString(R'R(Rtntpb((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt(testSortingRepeatedCompositeFieldsStable�s$ 

cCs�|j�}tjd�}d�}d|jj�_d|jj�_d|jj�_d|jj�_d|jj�_d|jj�_|jjd	|�|jg|jD]}|j^q�ddddddg�|jjd	|d
t�|jg|jD]}|j^qddddddg�t	j
dkrEdS|jjd|�|jg|jD]}|j^qhddddddg�|jjd
|d
t�|jg|jD]}|j^q�ddddddg�dS(sECheck sorting a repeated composite field using list.sort() arguments.R�cSst|j|j�S(N(tcmpR�(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyRRiiiiiiR�treverseNt
sort_functionR�(i(R"R�R�R�R�R�R�R0RFR{R|(R'R(Rtget_bbtcmp_bbtk((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt'testRepeatedCompositeFieldSortArgumentss.	""""cCsf|j�}|jjd�|jjd�|jjd�|jjdt�|jt|j�dddg�|jjdtdt�|jt|j�dddg�tj	dkr7d�}|jjd|�|jt|j�dddg�|jjd	|dt�|jt|j�dddg�n|j
jd
�|j
jd�|j
jd�|j
jdt�|jt|j
�ddd
g�|j
jdtdt�|jt|j
�d
ddg�tj	dkrbd
�}|j
jd|�|jt|j
�ddd
g�|j
jd	|dt�|jt|j
�d
ddg�ndS(s9Check sorting a scalar field using list.sort() arguments.i����i����i����R�R�icSstt|�t|��S(N(R�R�(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyR>RR�R�R�R�R�cSstt|�t|��S(N(R�RH(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyRLRN(i(i(R"R�R�R�R�R0tlistRFR{R|RXRH(R'R(Rtabs_cmptlen_cmp((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt$testRepeatedScalarFieldSortArguments2s6""	"%""	"cCs�|j�}|j�}|jjd�|jjd�|jjd�|jjd�|jjd�|jjd�d|jj�_d|jj�_d|jj�_d|jj�_d|jj�_d|jj�_tjdkr�dS||k}|j|jk}|jt	||�d�|jt	|j|j�d�|jt	|jdddg�d�|jt	|j|j�d�|j
t��t	|j|j�WdQXdS(Niiii(i(R"R�R�R�R�R�R{R|R0R�R R@(R'R(tm1tm2t_((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestRepeatedFieldsComparableRs2%cCs<|j�}|j|jtj�|j|jtj�dS(N(R"tassertIsInstanceR�tcollectionstMutableSequenceR�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestRepeatedFieldsAreSequencesuscCsV|j�}|jt��t|j�WdQX|jt��t|j�WdQXdS(N(R"R R@thashR�R�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestRepeatedFieldsNotHashable{s
cCs9|j�}|jjjg�|j|jd��dS(Ntpayload(tNestedTestAllTypesR�R�RYRdtHasField(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt$testRepeatedFieldInsideNestedMessage�scCs't||�|j|j|��dS(s�Make sure that a nested message object exists.

    As soon as a nested message attribute is accessed, it will be present in the
    _fields dict, without being marked as actually being set.
    N(tgetattrtassertFalseR�(R'RMt	attribute((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pytensureNestedMessageExists�s
cCs<|j�}|jt|jd�|jt|jd�dS(Ntno_such_oneof_fieldi(R"R t
ValueErrort
WhichOneofRA(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt testOneofGetCaseNonexistingField�scCs�|j�}|jd|jd��|j|jd��d|_|jd|jd��|j|jd��|j|jd��d|_	|jd|jd��|j|jd��|j|jd��dS(Ntoneof_fieldtoneof_uint32itoneof_stringR(
R"tassertIsRZR�R�R�R�R0RdR�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofDefaultValues�s		cCs�|j�}|jd|jd��d|_|jd|jd��|j|jd��d|_|jd|jd��|j	|jd��|j|jd��|j
|jd|jd��|j|jd��|j	|jd��|j
j|jd|jd��|j|jd��|j	|jd��d|j
_|jd|jd��|j	|jd��|j|jd��d|_|jd|jd��|j	|jd��|j|jd��dS(	NR�iR�ufooR�toneof_nested_messageR�toneof_bytes(
R"R�RZR�R�R0RdR�R�R�R�R�R�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofSemantics�s2		
	cCsU|j�}d|_|j|d�|jd|jd��|jd|j�dS(NiR�R�R�(R"R�R�R0R�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt!testOneofCompositeFieldReadAccess�s
	cCs|j�}|jd|jd��|tkrJ|j|jd��nd|_|jd|jd��|tkr�|j	|jd��nd|_
|jd|jd��|jd�|jd|jd��|tkr�|j|jd��ndS(NR�iR�R�R�(R"R�RZR�RR�R�R�R0RdR�t
ClearField(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofWhichOneof�s		
cCsz|j�}d|_|jd�|tkrG|j|jd��n|j|jd��|jd|jd��dS(NiR�R�(	R"R�R�RR�R�R�RZR�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofClearField�s	
cCsz|j�}d|_|jd�|tkrG|j|jd��n|j|jd��|jd|jd��dS(NiR�R�(	R"R�R�RR�R�R�RZR�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofClearSetField�s	
cCs�|j�}d|_|j|d�|jd�|jd|j�|tkrj|j|jd��n|j|jd��|jd|jd��dS(NiR�R�R�(	R"R�R�R�R0RRdR�R�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofClearUnsetField�s	
cCsQ|j�}d|_|j�}|j|j��|jd|jd��dS(NiR�R�(R"R�R.R1R0R�(R'R(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofDeserializes
	cCsK|j�}d|_|j�}|j|�|jd|jd��dS(NiR�R�(R"R�tCopyFromR0R�(R'R(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofCopyFroms
	
cCs�|j�}d|j_|j�}d|j_d|jj_|j|�|jd|jjd��|jd|jjjd��dS(NiR�R�R�R�(R�R�R�R�tchildt	MergeFromR0R�(R'R(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofNestedMergeFroms
cCs�|j�}d|jj_d|jjj_|j�}d|j_|j|�|jd|jjd��|jd|jjjd��dS(Niii
R�R�(	R�R�R�R�R�R�R�R0R�(R'R(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofMessageMergeFroms
		cCs8|jd|jj��}|jd|jd��dS(NR�R�(R"t
NestedMessageR0R�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofNestedMessageInit$s	cCs[|j�}d|_|j�|j|jd��d|_|jd|jd��dS(NiR�R�R�(R"R�R�tassertIsNoneR�R�R0(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestOneofClear)s	
	cCs5|j�}td�|_|j|jtj�dS(smAssigning a byte string to a string field should result
    in the value being converted to a Unicode string.RN(R"R%toptional_stringR�tsixt	text_type(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt"testAssignByteStringToUnicodeField1scCs�|j�}|jjd�|jtd�tt|j��!}|jt|j�t|��d|jj�_|jtd�tt|j��!}|jt|j�t|��dS(s|It should be possible to use long-valued indicies in slices

    This didn't used to work in the v2 C++ implementation.
    iiiN(	R"R�R�tlongRHR0R�R�R�(R'R(R�tsl((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestLongValuedSlice8s%%c	Cs�|j�}|jt��'}|jjd�td�D��WdQX|jt��'}|jjd�td�D��WdQXdS(s5This didn't use to work in the v2 C++ implementation.css|]}tVqdS(N(R�(t.0ti((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pys	<genexpr>Msi
Ncss|]}tVqdS(N(R�(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pys	<genexpr>Ps(R"R t	NameErrorR�RYtrangetrepeated_nested_enum(R'R(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt$testExtendShouldNotSwallowExceptionsIs&	igRucCs}|j�}|jg|j�x4tjD])}|jj|�|jg|j�q)W|jjg�|jg|j�dS(s,Test no-ops extending repeated int32 fields.N(R"tassertSequenceEqualR�RtFALSY_VALUESRY(R'R(R�tfalsy_value((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtendInt32WithNothingTscCs}|j�}|jg|j�x4tjD])}|jj|�|jg|j�q)W|jjg�|jg|j�dS(s,Test no-ops extending repeated float fields.N(R"R�RgRR�RY(R'R(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtendFloatWithNothingascCs}|j�}|jg|j�x4tjD])}|jj|�|jg|j�q)W|jjg�|jg|j�dS(s-Test no-ops extending repeated string fields.N(R"R�RXRR�RY(R'R(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtendStringWithNothingnscCs�|j�}|jg|j�|jjdg�|jdg|j�|jjddg�|jdddg|j�|jjddg�|jdddddg|j�dS(s7Test extending repeated int32 fields with python lists.iiiiiN(R"R�R�RY(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtendInt32WithPythonList{scCs�|j�}|jg|j�|jjdg�|jdg|j�|jjddg�|jdddg|j�|jjddg�|jdddddg|j�dS(s7Test extending repeated float fields with python lists.gg�?g@g@g@N(R"R�RgRY(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtendFloatWithPythonList�scCs�|j�}|jg|j�|jjdg�|jdg|j�|jjddg�|jdddg|j�|jjddg�|jdddddg|j�dS(s8Test extending repeated string fields with python lists.Rt11t22t33t44N(R"R�RXRY(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtendStringWithPythonList�scCsO|j�}|jg|j�|jjd�|jdddg|j�dS(sDTest extending repeated string fields with characters from a string.tabcR�R�R�N(R"R�RXRY(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtendStringWithString�stTestIterablecBs5eZdZdd�Zd�Zd�Zd�ZRS(s�This iterable object mimics the behavior of numpy.array.

    __nonzero__ fails for length > 1, and returns bool(item[0]) for length == 1.

    cCs|p	g|_dS(N(t_list(R'tvalues((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt__init__�scCsLt|j�}|dkrtS|dkr<t|jd�Std��dS(NiisTruth value is ambiguous.(RHR�R[tboolR�(R'tsize((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyRV�scCs
t|j�S(N(RHR�(R'((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt__len__�scCs
|jj�S(N(R�t__iter__(R'((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyR��sN(RSRTt__doc__RZR�RVR�R�(((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyR��s
		cCs�|j�}|jg|j�|jjtjg��|jg|j�|jjtjdg��|jdg|j�|jjtjddg��|jdddg|j�|jjtjddg��|jdddddg|j�dS(s3Test extending repeated int32 fields with iterable.iiiiiN(R"R�R�RYRR�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtendInt32WithIterable�scCs�|j�}|jg|j�|jjtjg��|jg|j�|jjtjdg��|jdg|j�|jjtjddg��|jdddg|j�|jjtjddg��|jdddddg|j�dS(s3Test extending repeated float fields with iterable.gg�?g@g@g@N(R"R�RgRYRR�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtendFloatWithIterable�scCs�|j�}|jg|j�|jjtjg��|jg|j�|jjtjdg��|jdg|j�|jjtjddg��|jdddg|j�|jjtjddg��|jdddddg|j�dS(s4Test extending repeated string fields with iterable.Rt1t2t3t4N(R"R�RXRYRR�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtendStringWithIterable�scCsitj�dks$tj�dkr(dS|j�}|jtj��}tj|jtj	�WdQXdS(Ntcppi(
RRtVersionR"R R^tPickleErrorR_R�tHIGHEST_PROTOCOL(R'R(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt!testPickleRepeatedScalarContainer�scCs|j�}|jj�dS(s?Exercise a scenario that has led to segfaults in the past.
    N(R"R�R�(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt'testSortEmptyRepeatedCompositeContainer�scCs5|j�}|jt��}|jd�WdQXdS(sBUsing HasField on a repeated field should raise an exception.
    R�N(R"R R�R�(R'R(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestHasFieldOnRepeatedField�scCs�|j�}|jt��}|jj�WdQX|jjtd��|jd|jj��|jd|jjd��|jd|jjd��|jddg|j�dS(Niiiiii(R"R t
IndexErrorR�tpopRYR�R0(R'R(R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestRepeatedScalarFieldPop�scCs|j�}|jt��}|jj�WdQX|jt��}|jjd�WdQXx,td�D]}|jj�}||_qfW|j	d|jj�j�|j	d|jjd�j�|j	d|jjd�j�|j	ddgg|jD]}|j^q��dS(NR=iiiiii(
R"R RR�R
R@R�R�R�R0(R'R(R�R�R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestRepeatedCompositeFieldPops
cCs~|j�}x?td�D]1}|jj||�|jj�}||_qW|j|j|j�|j|j|j�dS(Ni(	R"R�R�tinsertR�R�R�R�R0(R'R(R�R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestRepeatedCompareWithSelfs
cCsM|j�}|jj�}|j}|jj�}|j|jjd�dS(swA case that lead to a segfault when a message detached from its parent
    container has itself a child container.
    iN(R�trepeated_childR�R�R0R�toptional_int32(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestReleasedNestedMessagess
	cCs�|j�}|jt��g|_WdQX|jjd�tj�dkro|jt��g|_WdQXn|jt��g|_WdQXdS(NiR(R"R tAttributeErrorR�R�RRR@(R'R(R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestSetRepeatedComposite(sN(IRSRTR+R7R<RPR]RcRiRjRlRoRpRqRxRyRzR}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�RZR[t	bytearraytsetR�R�R�R�R�R�R�R�R\R�R�R�RR	R
RRRRRR(((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyRes�	
				$											-	-					(					 	#								#										
							*	
	
	
					
	
	
				
				
t
Proto2TestcBsYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	cCs\tj�}|j|jd��|j|jd��|j|jd��|jt��|jd�WdQX|jt��|jd�WdQX|jt��|jd�WdQX|jd|j�|jt|j	�|jd|j
j�d|_t|_	d|j
_|j|jd��|j|jd��|j|jd��d|_t
|_	d	|j
_|j|jd��|j|jd��|j|jd��|jd�|jd�|jd�|j|jd��|j|jd��|j|jd��|jd|j�|jt|j	�|jd|j
j�dS(
NRt
optional_booltoptional_nested_messagetfield_doesnt_existR�R�iii(RR"R�R�R R�R0RR[RRR�RdRFR�(R'R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestFieldPresence:sD				


cCs]tj�}|jt��}d|_WdQX|jt|jjd�|jjd�d|jd<|jt��d|jd<WdQXtj�}d|_|jjd�|j�}tj�}|j	|�|j
|jd��|jd|j�|jdt
|j��|j�|j	|j��|jd|j�|jd|jd�dS(	s:Assigning an invalid enum number is not allowed in proto2.i��Niii@�i��ttoptional_nested_enumi(RR"R R�RR�R�RR1R.R�R�R0RHR�(R'R�R�R�Rktm3((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestAssignInvalidEnumjs*
	

cCs@tj�}d|jd<|jt��d|jd<WdQXdS(Nii{i(RtTestEnumMaptknown_map_fieldR R�tunknown_map_field(R'R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestUnknownEnumMap�s
cCs&tj�}|jtt|d�dS(Nt
Extensions(RR"R RR�(R'RM((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestExtensionsErrors�scCs�tjd�}tj�}|j|�tj�}tj|�|j||�|j||j��tj	|�}|j||j��dS(NR5(
RRRtTestAllExtensionsR.tSetAllExtensionsR0R1R2R3(R'R4R5R;R6((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestGoldenExtensions�s

cCs�tjd�}tj�}|j|�tj�}tj|�|j||�|j||j��tj	|�}|j||j��dS(NR8(
RRRtTestPackedExtensionsR.tSetAllPackedExtensionsR0R1R2R3(R'R4R5R;R6((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestGoldenPackedExtensions�s

cCsmtjdd�}tj|�}tj|�}|j||�|j|jd�|jtj	|j
�dS(NR�i(RtTestRequiredR^R_R`R0R�R RtEncodeErrorR1(R'R5RaRb((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestPickleIncompleteProto�scCs`tj�tj�tj�g}d|d_d|d_d|d_d|d_tj�}d|_d|_d|_tjj�}|jj|�|j	j|�|j
j|�|jj|�|jj|�|j
j�jj|d�|j
j�jj|d�|j
j�jj|d�|jj�jj|d�|jj�jj|d�|jj�jj|d�|j�}tj�}|j|�|j|j|�|j|j|�|j|jj|�|j|jtjj|�|jt|j�d�|jt|j�d�|jt|jtjj�d�dS(scCheck the merge behavior when a required or optional field appears
    multiple times in the input.iiiithelloN(RR"Rtoptional_int64R�tTestParsingMergetRepeatedFieldsGeneratortfield1RYtfield2tfield3text1text2tgroup1R�R�tgroup2R1R.R0trequired_all_typestoptional_all_typest
optionalgrouptoptional_group_all_typesR%toptional_extRHtrepeated_all_typest
repeatedgrouptrepeated_ext(R'tmessagestmerged_messaget	generatortdatat
parsing_merge((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestParsingMerge�sJ		



			

cCsKtjddddddddd	id
d6did
d6didddidd6idd6gddtjjgdddd�}|j|tj�|jd|j�|jd|j�|jd|j�|jd|j�|jd
|j	j
�|j|jtjj�|jd
|jj
�|j|jd��|j|jtj��|jtjj|j�|jdt|j��|jd|jdj
�|jd|jdj
�|jdt|j��|jtjj|jd�|jtjj|jd�|jd|j�|jd|j�|j|jd��|jdt|j��|jd|j�tjdd �}|jtjj|j�|jt��tjdid!d"6�WdQX|jt��tjdid#d6�WdQX|jt��tjdd$�WdQX|jt��tjdd�WdQXdS(%NRidtoptional_fixed32i�Reg�r@toptional_bytesRR=i�R�Ri�R�toptional_foreign_messageRtBAZRAiXi�R�tFOOt
default_int32i R�RiiiR1i*uBAZitINVALID_NESTED_FIELDtINVALID_VALUE_TYPEt
INVALID_LABEL( RR"tBARR�R0RRIReRJR=R�RR�R�RdR�RKtForeignMessageRLRRHRAR�RMRNR�R�Rgt
default_int64R R�R@(R'R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestPythonicInit�sl	


	



		(RSRTRR R$R&R)R,R/RHRU(((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyR8s	0							1t
Proto3TestcBs(eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!RS( cCsRt|�}x/|D]'\}}|j|||�||=qW|ji|�dS(N(tdictR0(R'tmap_itert
dict_valueR�tv((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pytassertMapIterEquals+s
cCsrtj�}|jt��|jd�WdQX|jt��|jd�WdQX|jt��|jd�WdQX|jt��|jd�WdQX|j|jd��|jt��|jd�WdQX|jt��|jd�WdQX|jt��|jd�WdQX|jd	|j�|jd	|j�|jd
|j	�|jt
|j�|jd	|jj
�d	|j_
|j|jd��d|_d|_d
|_	t|_d|j_
|jd�|jd�|jd�|jd�|jd�|jd	|j�|jd	|j�|jd
|j	�|jt
|j�|jd	|jj
�dS(NRReR�RRRR�R�iRig�������?R�i(RR"R R�R�R�R0RReR�R[RRR�RdRFR�(R'R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyR5sL				




cCs�tj�}d|_|jd|j�|jjd�|jd|jd�d|jd<|jd|jd�|j�}tj�}|j|�|jd|j�|jd|jd�dS(sCAssigning an unknown enum value is allowed and preserves the value.i��i��Tii��tN(RR"RR0R�R�R1R.(R'R�RkR�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestAssignUnknownEnumns	

cCstj�}|jd|jk�|jd|jk�|jd|jk�|jd
|jk�|jd|jk�|jt|j	k�|jd|j
k�|jd|jk�|jd|jk�|j
d|jd�|j
d|jd�|j
d|jd�|j
d|jd�|j
d	|jd�|jt|jdt��|j
t|j	t�|jt|j	tt��|j
d
|j
d�|j
d
|jd�|j
d|jd�|jd|jk�|jd|jk�|jd|jk�|jd|jk�|jd|jk�|jt|j	k�|jd|j
k�|jd|jk�|jd|jk�|j|j
dtj�|jt��|j
dWdQX|jt��d|j
kWdQXdS(Ni����ii!i{R�ioixigRll����lll����lll����l(RtTestMapR�tmap_int32_int32tmap_int64_int64tmap_uint32_uint32tmap_uint64_uint64tmap_int32_doubleR[t
map_bool_booltmap_string_stringtmap_int32_bytestmap_int32_enumR0Rdt
isinstancetfloatR�R�R�R�R R@(R'RM((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestScalarMapDefaults�sFcCs�tj�}|j|jjd��|jd|jjdd��|j|jjd��d|jd<|jd|jjd��|jd|jjd��|jt��|jjd�WdQX|j|jjd��|jd|jjdd��|jd}|j	||jjd��t
j�dkrd|jt��|jjd�WdQXn|jd|jjd��dS(Nii
iRR(
RR]R�R^tgetR0R R@tmap_int32_foreign_messageR�RRRZ(R'RMtsubmsg((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt
testMapGet�s"

c
Cs�tj�}|jdt|j��|jd|jk�d|jd<d|jd<d|jd	<d|jd<d
|j	d<d|j
d<d
|jd<t|j
t<d|jd<d|jd	<|jg|j��|jdt|j��|jt��d
|jd	<WdQX|jdt|j��|jt��d	|jd
<WdQX|j�}tj�}|j|�|jt��d
|jd	<WdQX|jt��d	|jd
<WdQX|jd|jd�|jd|jd�|jd|jd	�|jd|jd�|jd
|j	d�|jd|j
d�|jd
|jd�|jt|j
t�|jd|jd�|jd|jd	�tj�dkr�|jdt|j��ndS(Niii8���i����ii"i!i�i{g333333�?gffffff
@it123R�ixRs{-123: -456}ll����ll����llll����ll����ll(RR]R0RHR^R�R_R`Ratmap_int32_floatRbRdRFRcRftFindInitializationErrorsR R@R1R.R�RRR%(R'RMRktmsg2((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt
testScalarMap�sP










	cCsVtj�}d|jd<d|jd<|j|j�d�|jd|j��dS(NiRis
r
(RR]R^RdR0tByteSizeR1(R'RM((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMapEntryAlwaysSerializeds

	cCs�tj�}d}|jd�}||j|<t|jj��d\}}|j||�|j||�|j|tj	�|j|tj	�dS(Nuሴtutf8i(
RR]tencodeRdR�titemsR0R�R�R�(R'RMtunicode_objt	bytes_objR�tvalue((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt testStringUnicodeConversionInMaps
cCs�tj�}|jdt|j��|jd|jk�|jd|jjd�|jdt|j��|jd|j�|jd|j�|jdt|j��|jt	��|jdWdQX|jt
��|jd|jd<WdQX|jdt|j��|j�}tj�}|j|�|jdt|j��|jd|j�|jd|j�|jdt|j��t
j�dkr�|jd	tt|j���ndS(
Niii{i8���iRni�Ri(RR]R0RHRkR�t
get_or_createR$R R@R�R1R.RRR%(R'RMRkRq((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMessageMap&s0
	cCs�tj�}d|jdj_|jd=d|jdj_|jdt|j��d|jdj_|jdt|j��|j�}tj�}|j|�ddg}x|D]}|j|=q�WdS(Nii(	RR]tmap_int32_all_typesRR�R0RHR1R.(R'RMRkRqtkeysR�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestNestedMessageMapItemDeleteOs


cCs�tj�}d|jd<|j�}d|jd<|j|j�|d�d|jd_|j�}d|jd_|j|j�|d�dS(Nii�i(RR]R^RsR0RkR�(R'RMR�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMapByteSize`s

cCs�tj�}d|jd<d|jd<d|jd<d|jd_d	|jd
_tj�}d|jd<d|jd
<d|jd
_d|jd
_|jd
}|j|�|jd|jd�|jd|jd�|jd|jd�|jd|jd
�|jd|jdj�|jd	|jd
j�|j	|jd
j
d��tj�dkr�|jd|j�ni}x8|jD]-}|j	||k�|j|j||<q�W|jidd6d	d
6|�|jd=|j	d|jk�|jd
=|j	d
|jk�tj�dkr\|j
t��|jd=WdQXn |j
t��|jd=WdQXdS(Ni"iiNi8i!iiioi
i�i7iciXiitdRR(RR]R^R_RkR�R�R�R0R�R�RRR R@tKeyError(R'RMRqt
old_map_valuetas_dictR�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt
testMergeFromlsH








cCs6tj�}|jtd��|jd�WdQXdS(NsWParameter to MergeFrom\(\) must be instance of same class: expected .*TestMap got int\.i(RR]tassertRaisesRegexpR@R�(R'RM((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMergeFromBadType�s

cCs6tj�}|jtd��|jd�WdQXdS(Ns[Parameter to [A-Za-z]*From\(\) must be instance of same class: expected .*TestMap got int\.i(RR]R�R@R�(R'RM((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestCopyFromBadType�s

cCs�tj�}td�|jtd�<td	�|jtd�<td�|jtd�<td�|jtd
�<|j�}tj�}|j|�|j	d|jd�|j	d|jd�|j	d|jd�|j	d|jd�dS(Ni8���i����ii"i!i�i{ll����ll����llll����ll����ll(
RR]R�R^R_R`RaR1R.R0(R'RMRkRq((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestIntegerMapWithLongs�s
cCs�tj�}d|jjd<|j�}tj�}|j|�|j||�d|jjd<|j�}|j|�|j||�|jjj�|j�}|j|�|j||�dS(Ni�i{i�ix(RtTestMapSubmessagettest_mapR^R1R.R0tclear(R'RMRkRq((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMapAssignmentCausesPresence�s


cCstj�}d|jjd_|j�}tj�}|j|�|j||�d|jjd_|j�}|j|�|j||�|jjdj|jjd�|j�}|j|�|j||�|jjj	�|j�}|j|�|j||�dS(Nii{iix(
RR�R�RkR�R1R.R0R�R�(R'RMRkRq((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt-testMapAssignmentCausesPresenceForSubmessages�s&



cCs�tj�}t|j�}t|j�}d|jd<d|jd_|jt��x|D]}q^WWdQX|jt��x|D]}q�WWdQXdS(NRnR�i(RR]titerRdRkR�R tRuntimeError(R'RMtstring_string_itertint32_foreign_iterR�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestModifyMapWhileIterating�s



cCs�tj�}|jd}|j||jd�|j|tj�d|_|j�}tj�}|j	|�|j
d|jdj�|jt��tj�|jd<WdQXdS(NioiiX(
RR]RkR�R�RRSR�R1R.R0R R�(R'RMRlRkRq((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestSubmessageMaps
	
cCs�tj�}x*|jj�D]\}}|jt�qWd|jd<d|jd<d|jd<|jdt|j��idd6dd6dd6}|j|jj�|�dS(Niiiii(	RR]R^RwRdR[R0RHR[(R'RMR�RZt
matching_dict((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMapIterations


c
s�tjdkr�tj�}d|jd<d|jd<d|jd<d|jd<|j}�jdt|��tj�}|j|j���fd�}||j	�|j
��||j�|j��||j
�|j���jd|jd���jd|jd	���jd|jd���jd
|jd���jdt|��|j�\}}�jd||��jdt|��|j��jd
t|���jt��|j�WdQX�jd
|jd���jdt|��|j|j��jdt|���jt��|j|j|j�WdQX�jt��|jd
�WdQX�jt��|jdd
�WdQXndS(Niiiiii
ics8�jt|�|d��jt|�|d�dS(Nii(R0tnextR�(tseqtiterator(R'(sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt
CheckItems9si�iiRzi(i(R{R|RR]R^R0RHR.R1Rwt	iteritemsRtiterkeysR�t
itervaluesRjRZR
tpopitemR�R R�t
setdefaulttupdateR@(R'RMt	map_int32RqR�R�Rz((R'sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestPython2Map-sJ



	
cCstj�}d|jd<d|jd<d|jd<d|jd<d|jd<|jj�}|jj�}|j||�dS(NRt
local_init_opttrainable_variablest	variablestinit_opt	summaries(RR]RdRwR0(R'RMtitems1titems2((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMapItems]s




cCs�d}tj�}d|jd<d|jd<d|jd<d|jd	<d
|jd<d
|jd<d
|jd<d|jd<d|jd<|j||jdt��dS(Ns�r
init_opdr

item1er

item2fr

item3gr
item4QQr

local_init_opar
	summarieser
trainable_variablesbr
	variablescR�R�R�R�R�R�R�R�teR�titem1tftitem2tgtitem3tQQtitem4RQ(RR]RdR0R1RF(R'R4RM((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt!testMapDeterministicSerializationls	








cCsttj�}d|jd<d|jd<d|jd<|jj�}~idd6dd6dd6}|j||�dS(Niiiii(RR]R^RwR[(R'RMtitR�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMapIterationClearMessage�s


cCs�tjdidd6dd6�}|jd|jd�|jd|jd�tjditjdd�d6�}|jd|jdj�dS(	NR^iiiiRkR�i(RR]R0R^RRSRkR�(R'RM((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMapConstruction�s 	cCs�tj�}|j}d|d<d|d<d|d<|jd�|jd|j��idd6dd6dd6}|j|j�|�dS(NiiiiiR^R(RR]R^R�R0R1R[Rw(R'RMt	int32_mapR�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMapValidAfterFieldCleared�s	



cCsbtj�}|j}d|d_|jd�|jd|j��|jd|j�k�dS(NiiRkR(	RR]RkR�R�R0R1RdR(R'RMtint32_foreign_message((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt$testMessageMapValidAfterFieldCleared�s	

cCs�tj�}t|j�}|jd�|jt��x|D]}q?WWdQXt|j�}|jd�|jt��x|D]}q�WWdQXdS(NR^Rk(RR]R�R^R�R R�Rk(R'RMR�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt"testMapIterInvalidatedByClearField�s




cCs�tj�}|jdt|j��d|jd<|jdt|j��|jt��|jd=WdQX|jd=|jdt|j��|jt��|jd=WdQXdS(NiiiiiXi (RR]R0RHR^R R�R~(R'RM((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt
testMapDelete�s

cCshtj�}|j|jtj�|j|jtj�|j|jtj�|j|jtj�dS(N(RR]R�R^R�tMappingtMutableMappingRk(R'RM((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMapsAreMapping�scCs\tj�}d|jd<|j|j|j�|j|j|j�|j|jd�dS(Ni8���i����i(RR]R^R0RktassertNotEqual(R'RM((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestMapsCompare�s

cCsVtj�}d|jd<d|jd<d|jd_|jdt|j���dS(NRnR�i@i#itfooi(	RR]RdR^tmap_string_foreign_messageR�R0RHRp(R'RM((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt(testMapFindInitializationErrorsSmokeTest�s


("RSRTR[RR\RiRmRrRtR{R}R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyRV(s@	
	9		0		=			)			<									0							
				tValidTypeNamesTestcBseZd�Zd�ZRS(cs�tt|��jd�d�d|d|f}|jt�fd�|D��d�|f��jd�}|d}dj|d �}t|d	|g�dS(
Nt'isRepeated%sContainersRepeated%sFieldContainerc3s|]}�j|�VqdS(N(tendswith(R�RZ(ttp_name(sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pys	<genexpr>ss%r does end with any of %rt.i����tfromlist(R%ttypetsplitRdtanytjoint
__import__(R'RMt	base_nametvalid_namestpartst
class_nametmodule_name((R�sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pytassertImportFromName�s

cCs6tj�}|j|jd�|j|jd�dS(NtScalart	Composite(RR"R�R�R�(R'R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestTypeNamesCanBeImported
s(RSRTR�R�(((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyR��s	
tPackedFieldTestcBs#eZd�Zd�Zd�ZRS(cCs�|jjd�|jjd�|jjd�|jjd�|jjd�|jjd�|jjd�|jjd�|j	jd�|j
jd�|jjd�|jjd�|j
jt�|jjd�dS(Nig�?(R�R�trepeated_int64trepeated_uint32trepeated_uint64trepeated_sint32trepeated_sint64trepeated_fixed32trepeated_fixed64trepeated_sfixed32trepeated_sfixed64RgRht
repeated_boolRFR�(R'R((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt
setMessagescCs9tj�}|j|�d}|j||j��dS(NsH
"*2:BJRZ�?b�?jr(RR9R�R0R1(R'RR4((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestPackedFields"s
cCs9tj�}|j|�d}|j||j��dS(Ns: (0=AMQ]�?a�?hp(RtTestUnpackedTypesR�R0R1(R'RR4((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestUnpackedFields5s
(RSRTR�R�R�(((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyR�s		Riis;explicit tests of the C++ implementation for PY27 and abovetOversizeProtosTestcBs2eZed��Zd�Zd�Zd�ZRS(cCscd}tj�}tj�}tj||�|j|�tj|�j	|j
d��|_dS(Ns�
      name: "f/f.msg2"
      package: "f"
      message_type {
        name: "msg1"
        field {
          name: "payload"
          number: 1
          label: LABEL_OPTIONAL
          type: TYPE_STRING
        }
      }
      message_type {
        name: "msg2"
        field {
          name: "field"
          number: 1
          label: LABEL_OPTIONAL
          type: TYPE_MESSAGE
          type_name: "msg1"
        }
      }
    sf.msg2(R	tDescriptorPoolRtFileDescriptorProtoRtParsetAddR
tMessageFactorytGetPrototypetFindMessageTypeByNamet	proto_cls(tclst	file_desctpooltdesc((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt
setUpClassNs
cCs8|j�|_dd|jj_|jj�|_dS(NR�ii@iiii(R�tptfieldR�R1tp_serialized(R'((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pytsetUpqscCsmddlm}|t�|j�}y|j|j�Wn,tjk
rh}|jt	|�d�nXdS(Ni����(tSetAllowOversizeProtossError parsing message(
tgoogle.protobuf.pyext._messageR�R[R�R.R�RRCR0R%(R'R�tqR�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestAssertOversizeProtovs
cCsYddlm}|t�|j�}|j|j�|j|jjj	|jj	�dS(Ni����(R�(
R�R�RFR�R.R�R0R�R�R�(R'R�R�((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyttestSucceedOversizeProtos

(RSRTtclassmethodR�R�R�R�(((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyR�Is#			t__main__(4R�t
__author__R�R2RrR�R^R�R{RDt	unittest2tunittesttImportErrorR�R�tgoogle.protobufRRRRRR	R
Rtgoogle.protobuf.internalRR
RRRRRtPY3tintR�RRRRtBaseTestCasetNamedParametersRRRVR�R�tskipIfRR|R�RStmain(((sI/usr/lib/python2.7/site-packages/google/protobuf/internal/message_test.pyt<module>)st


								��������9	: