Your IP : 18.117.192.205


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

�
Du�ac@sMdZdZyddlZWnek
r;ddlZnXddlmZddlmZddlmZddl	m
Z
ddl	mZdd	l	mZdd
l	m
Z
ddl	mZddl	mZdd
l	mZejZd�Zdefd��YZdefd��YZdefd��YZedkrIej�ndS(sJTest for preservation of unknown fields in the pure Python implementation.s!bohdank@google.com (Bohdan Koval)i����N(tunittest_mset_pb2(tunittest_pb2(tunittest_proto3_arena_pb2(tapi_implementation(tencoder(tmessage_set_extensions_pb2(tmissing_enum_values_pb2(t	test_util(ttesting_refleaks(t
type_checkerscCs4tjtj�dko'tj�dkd�|�S(Ntcppis7Addtional test for pure python involved protect members(tunittesttskipIfRtTypetVersion(tfunc((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyt(SkipCheckUnknownFieldIfCppImplementation;s!tUnknownFieldsTestcBsYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	cCsftjj|_tj�|_tj|j�|jj�|_tj	�|_
|j
j|j�dS(N(RtTestAllTypest
DESCRIPTORt
descriptort
all_fieldsRtSetAllFieldstSerializeToStringtall_fields_datatTestEmptyMessaget
empty_messagetParseFromString(tself((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pytsetUpCscCs)|jj�}|j||jk�dS(N(RRt
assertTrueR(Rtdata((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyt
testSerializeKscCs^tj�}|j|j�|r>|j|j|j��n|jdt|j���dS(Ni(RRRRtassertEqualRtlen(Rtpreservetmessage((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pytexpectSerializeProto3Rs
cCsFtj�}|j|�tj|�|j|�tj|�dS(N(Rt&GetPythonProto3PreserveUnknownsDefaultR%t&SetPythonProto3PreserveUnknownsDefault(Rtdefault_preserve((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyttestSerializeProto3Zs
cCs&|j|jj�|jj��dS(N(R!RtByteSizeR(R((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyttestByteSizedscCs#|jdt|jj���dS(Ni(R!R"Rt
ListFields(R((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyttestListFieldsgscCs�tj�}|jj�}d|_tj�}d|_|j�|_	|j�}tj
�}|j|�|j�}tj�}|j|�|j||�dS(Ni���i90(
Rt
RawMessageSettitemtaddttype_idRtTestMessageSetExtension1tiRR$tTestMessageSettMergeFromStringR!(RtrawR/tmessage1t
serializedtprototreserializedtnew_raw((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyt1testSerializeMessageSetWireFormatUnknownExtensionks		

cCsltj�}|j|j�|j|j|�|jjd�|j|jj��|j	|j|�dS(Ntoptional_string(
RRRRR!RRt
ClearFieldRtassertNotEqual(RR$((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyt
testEquals�scCs�|jj�|jd|jj��tj�}tj�}d|_|jj|j��|j	j
�j|j��|jd|jj��|jd|j	dj��|j�|jd|jj��|jd|j	dj��dS(Nttdiscardi(RtDiscardUnknownFieldsR!RRRR=toptional_nested_messageRtrepeated_nested_messageR0R?(RR$t
other_message((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyttestDiscardUnknownFields�s"
		


(t__name__t
__module__RR R%R)R+R-R<R@RG(((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyRAs				
					tUnknownFieldsAccessorsTestcBsMeZd�Zd�Zed��Zd�Zd�Zd�Zd�Z	RS(cCsftjj|_tj�|_tj|j�|jj�|_tj	�|_
|j
j|j�dS(N(RRRRRRRRRRRR(R((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyR�sc
Cs�|jj|}tj|j}tj|j|�}i}x\|jj	D]N\}}||krHt
jj|d}	|	|dt
|�|j|�qHqHW|j|||�dS(Ni(Rtfields_by_nameR	tFIELD_TYPE_TO_WIRE_TYPEttypeRtTagBytestnumberRt_unknown_fieldsRRt_decoders_by_tagR"RR!(
Rtnametexpected_valuetfield_descriptort	wire_typet	field_tagtresult_dictt	tag_bytestvaluetdecoder((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pytCheckUnknownField�s&cCs�|jd|jj�|jd|jj�|jd|jj�|jd|jj�|jd|jj�|jd|jj�|jd|jj�dS(Ntoptional_nested_enumtrepeated_nested_enumtoptional_int32toptional_fixed32toptional_fixed64R=t
optionalgroup(	R[RR\R]R^R_R`R=Ra(R((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyttestCheckUnknownFieldValue�s	
	
	
	
	
	
	cCs9tj�}|j|j�|j|j�|j�dS(N(RRtCopyFromRR!RR(RR$((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyttestCopyFrom�scCs�tj�}d|_d|_tj�}|j|j��|jd�d|_d|_tj�}|j|j��|j	|�|j|j��|j
|jd�|j
|jd�|j
|jd�dS(NiiR^ii(RRR^toptional_uint32RRRR>toptional_int64t	MergeFromR!(RR$tsourcetdestination((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyt
testMergeFrom�s		
		
cCs*|jj�|j|jj�d�dS(NRA(RtClearR!R(R((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyt	testClear�s
cCs9tj�}|j|j�|j|j�|j�dS(N(RtTestEmptyMessageWithExtensionsRRR!R(RR$((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyttestUnknownExtensions�s(
RHRIRR[RRbRdRjRlRn(((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyRJ�s					tUnknownEnumValuesTestcBsVeZd�Zd�Zd�Zd�Zd�Zd�Zed��Z	d�Z
RS(cCs�tjj|_tj�|_tjj|j_|jjjtjjtjj	g�|jj
jtjjtjj	g�|jj�|_tj
�|_|jj|j�dS(N(RtTestEnumValuesRRR$tZEROR\R]textendtONEtpacked_nested_enumRtmessage_datatTestMissingEnumValuestmissing_messageR(R((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyR�s		c
Cs�|jj|}tj|j}tj|j|�}i}x\|jj	D]N\}}||krHt
jj|d}	|	|dt
|�|j|�qHqHW|j|||�dS(Ni(RRKR	RLRMRRNRORwRPRRpRQR"R$R!(
RRRRSRTRURVRWRXRYRZ((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyR[s	&cCsKtj�}d|_tj�}|j|j��|j|jd�dS(Ntblahi(Rt
JustStringtdummyRpRRR!R\(Rtjust_stringtmissing((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyt!testUnknownParseMismatchEnumValue$s
	cCsk|j|jjd��|j|jjd�|jj�}|jjd�|j|jj�|�dS(NR\i(tassertFalseRwtHasFieldR!R\RR>(RR8((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyttestUnknownEnumValue1s
cCs|jg|jj�dS(N(R!RwR](R((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyttestUnknownRepeatedEnumValue9scCs|jg|jj�dS(N(R!RwRt(R((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyttestUnknownPackedEnumValue<scCsF|jd|jj�|jd|jj�|jd|jj�dS(NR\R]Rt(R[R$R\R]Rt(R((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyt!testCheckUnknownFieldValueForEnum?s	
	
	cCs9tj�}|j|jj��|j|j|�dS(N(RRpRRwRR!R$(Rtnew_message((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyt
testRoundTripHs(RHRIRR[R}R�R�R�RR�R�(((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyRo�s			
				t__main__(t__doc__t
__author__t	unittest2RtImportErrortgoogle.protobufRRRtgoogle.protobuf.internalRRRRRRR	tBaseTestCaseRRRJRoRHtmain(((sP/usr/lib/python2.7/site-packages/google/protobuf/internal/unknown_fields_test.pyt<module>!s,
		`\Q

?>