Your IP : 52.15.233.83


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

�
Du�ac@s�dZdZyddlZWnek
r;ddlZnXddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
dejfd��YZed
kr�ej�ndS(s*Tests for google.protobuf.message_factory.s"matthewtoia@google.com (Matt Toia)i����N(tdescriptor_pb2(tapi_implementation(tfactory_test1_pb2(tfactory_test2_pb2(tdescriptor_database(tdescriptor_pool(tmessage_factorytMessageFactoryTestcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs:tjjtjj�|_tjjtjj�|_dS(N(	RtFileDescriptorProtot
FromStringRt
DESCRIPTORt
serialized_pbtfactory_test1_fdRtfactory_test2_fd(tself((sQ/usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pytsetUp4s		cCs�|�}d|_d|_d|j_d|j_d|j_d|jj_d|j_|jj	j
dddg�|jj	jd	�d|_d|_d|j_d|j_d
|jj_d|j_d|_|j	j
d	ddg�|j	jd�|j
j�d
|j
d_d|j
d_|j
jdddd�d
|jj_d|jjjj_|j�}tjj|�}|j�}|j||�|j|�}|j||�dS(Ni*isnested message valueiiuoneutwouthreeufourisone deeps	zero deepthellotworldtpart_1ttestingtpart_2t123i(t	mandatorytnested_factory_2_enumtnested_factory_2_messagetvaluetfactory_1_messagetfactory_1_enumtnested_factory_1_enumtnested_factory_1_messagetscalar_valuet
list_valuetextendtappendtcircular_messagetgroupedtaddRRtlooptSerializeToStringRtFactory2MessageR	tassertEqual(Rtclstmsgt
serializedt	convertedtreserializedtresult((sQ/usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyt_ExerciseDynamicClass:s>						
cCs�tj�}tj|�}|j|j�|j|j�tj�}|j	|j
d��}|j|tj
k�|j|�|j	|j
d��}|j||k�dS(Ns/google.protobuf.python.internal.Factory2Message(RtDescriptorDatabaseRtDescriptorPooltAddRR
RtMessageFactorytGetPrototypetFindMessageTypeByNametassertFalseRR'R/t
assertTrue(RtdbtpooltfactoryR)tcls2((sQ/usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyttestGetPrototype\s
cCsxtd�D]}|j|jj|jj�tj|j|jg�}|jt	ddg�j
t	|j����|j|d�|d}|jt	ddg�j
t	d�|j
jjj|j
�D����|d�}|jjd�}|jjd�}d|j|<d|j|<|jd|j|�|jd|j|�|jd|jjd	��tj�d
kr�|jt|j�t|j��|jt|jjd�|jt|jjd�q
|jd|jjd��|jd|jjd��q
WdS(
Nis/google.protobuf.python.internal.Factory2Messages/google.protobuf.python.internal.Factory1Messages>google.protobuf.python.internal.Factory2Message.one_more_fields-google.protobuf.python.internal.another_fieldcss|]}|jVqdS(N(t	full_name(t.0text((sQ/usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pys	<genexpr>�sttest1ttest2i!0tcppit(trangetassertInRtnameR
t
dependencyRtGetMessagesR7tsettissubsettkeysR/R
tfileR9tFindAllExtensionst
Extensionst_FindExtensionByNameR(tNonet_FindExtensionByNumberRtTypetlentassertRaisest	TypeError(Rt_tmessagestfactory_msg1tmsg1text1text2((sQ/usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyttestGetMessagesjsN

	
				

	"				c	CsDtj�}tjd|�}tj�}d|_d|_|jj	�}d|_|j
j	�}d|_d|_|j
|�|j|jg�}|jd|�tj�}d|_d|_|jjd�|jj	�}d	|_|jj	�}d
|_d|_tjj|_d	|_d|_|j
|�|j|jg�}|jd|�tj�}d
|_d|_|jjd�|jj	�}d|_|jj	�}d
|_d|_tjj|_d|_d|_|j
|�|jt��}|j|jg�WdQX|jt|j�ddg�dS(NR9s(google/protobuf/internal/container.protosgoogle.protobuf.python.internalt	Containerii
s)google.protobuf.python.internal.Containers(google/protobuf/internal/extension.protot	Extensiontextension_fieldis)google.protobuf.python.internal.Extensions(google/protobuf/internal/duplicate.protot	Duplicates�Extensions "google.protobuf.python.internal.Duplicate.extension_field" and "google.protobuf.python.internal.Extension.extension_field" both try to extend message type "google.protobuf.python.internal.Container" with field number 2.s!Double registration of Extensions(RR1RR3RRRFtpackagetmessage_typeR$textension_rangetstarttendR2RHRERGR!t	extensiontnumbertFieldDescriptorPrototLABEL_OPTIONALtlabelt	type_nametextendeeRTt	Exceptiontstrt	exception(	RR9R:tfR*trngtmsgsR?tcm((sQ/usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyttestDuplicateExtensionNumber�s\					
							
							
(t__name__t
__module__RR/R<R\Rt(((sQ/usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyR2s
		"		4t__main__(t__doc__t
__author__t	unittest2tunittesttImportErrortgoogle.protobufRtgoogle.protobuf.internalRRRRRRtTestCaseRRutmain(((sQ/usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyt<module> s
�

?>