Your IP : 18.116.86.134


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

�
Du�ac@s1dZdZyddlZWnek
r;ddlZnXddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlmZdd
lmZdZdejfd��YZdejfd��YZedkr-ej�ndS(s�Unittest that directly tests the output of the pure-Python protocol
compiler.  See //google/protobuf/internal/reflection_test.py for a test which
further ensures that we can use Python protocol message objects as we expect.
s#robinson@google.com (Will Robinson)i����N(ttest_bad_identifiers_pb2(tunittest_custom_options_pb2(tunittest_import_pb2(tunittest_import_public_pb2(tunittest_mset_pb2(tunittest_mset_wire_format_pb2(t unittest_no_generic_services_pb2(tunittest_pb2(tservice(tsymbol_databasei t
GeneratorTestcBs�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�ZRS(cCs6d}tj}|j|jj|jj|j�dS(Ntoptional_nested_message(RtTestAllTypestassertEqualt
NestedMessaget
DESCRIPTORtfields_by_nametmessage_type(tselft
field_namet
proto_type((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestNestedMessageDescriptor@s
		cCs�|jdtj�|jdtj�|jdtj�tj�}|jd|j�|jdtjj�|jd|j�|jdtjj�|jd|j�|jdtjj�dS(Niiiiii(	R
RtFOREIGN_FOOtFOREIGN_BARtFOREIGN_BAZRtFOOtBARtBAZ(Rtproto((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyt	testEnumsGscstj�}d���fd�}|j||j��|j|jdk�|j||j��|j|jdk�|j�|j��|j||j��|j|jdk�|j||j��|j|jdk�|j�|j��|j	d|j
�dS(NcSs
||kS(N((tval((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pytisnan\scs�|�o�|d�S(Ni((R(R(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pytisinf_sis? ? ?? ?? ??? ??/ ??-(RtTestExtremeDefaultValuest
assertTruet
inf_doubletneg_inf_doublet
nan_doublet	inf_floatt
neg_inf_floatt	nan_floatR
tcpp_trigraph(RtmessageR ((RsK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestExtremeDefaultValuesWs	cCstjj}itd6td6td6td6}tg|jD]'}|j|kr;|j|jf^q;�}|j	||�dS(Ntoptional_int32trepeated_int32Rt
default_int32(
RRRtFalsetTruetdicttfieldstnamethas_default_valueR
(Rtdesctexpected_has_default_by_nametfthas_default_by_name((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestHasDefaultValuesps

*cCs?|jtjjtjj�|jtjjjtjj�dS(N(R
Rtoptional_int32_extensiontcontaining_typetTestAllExtensionsRtTestRequiredtsingle(R((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyt'testContainingTypeBehaviorForExtensions�s
cCs9|jtjjd�|jtjjjtjj�dS(N(R
RR:textension_scopetNoneR=R>R(R((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestExtensionScope�scCsW|jtjj�|jtjjj�tjj}|jd}|j|j�dS(Nta(R"RR:tis_extensionR=R>RR(Rtmessage_descriptortnon_extension_descriptor((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestIsExtension�s

cCs)tj�}|j|jj�j�dS(N(RtTestMessageSetR"Rt
GetOptionstmessage_set_wire_format(RR((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestOptions�scCs9tj�}|jjdj�}|j|dk	�dS(NtAnEnum(RtTestMessageWithCustomOptionsRtenum_types_by_nameRIR"RA(RRtenum_options((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestMessageWithCustomOptions�scCs�|jttjjj�ttjjjtjjjtjjjg��|jtj	jjg�|jtjjjjg�dS(N(
R
tsetRRRtnested_typesRt
OptionalGroupt
RepeatedGrouptTestEmptyMessage(R((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestNestedTypes�scCs�|jtjjjdk�|jtjjjdk�|jtjjjjtjj�|jtjjjjtjj�|jtjj	jjtjj�dS(N(
R"RRURR;RARR
RRT(R((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestContainingType�s

cCs9|jtjjdk�|jtjjtjj�dS(N(	R"Rt_FOREIGNENUMR;RAR
t_TESTALLTYPES_NESTEDENUMRR(R((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyt"testContainingTypeInEnumDescriptor�scCs�|jtjjjjd�tjjj}|j|jjd�|jtjjjjd�|jtj	jjd�|jtj
jjd�|jtjjjd�dS(Ntprotobuf_unittesttprotobuf_unittest_import(R
RRRtfiletpackageRRt
ImportMessageRXRYt_IMPORTENUM(RR5((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestPackage�s cCsg|jtjjjg�|jtjjjdtfg�|jtjjjdddtfg�dS(	Nii*i+i/i�i(i*i+(i/i�(R
RRRtextension_rangesR<t
MAX_EXTENSIONtTestMultipleExtensionRanges(R((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestExtensionRange�scCs�|jtjjd�|jtjjd�|jtjjdk�|jtjjt	jg�|jt	jjt
jg�|jt	jjt
jg�dS(Nsgoogle/protobuf/unittest.protoR[(R
RRR3R^tassertFalset
serialized_pbRAtdependenciesRRtpublic_dependencies(R((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestFileDescriptor�s

cCst|jttd��|jttd��|jttd��ttd�rp|jttjtj��ndS(NtTestMessageRttest_extensiontTestService(R"thasattrRRft
issubclassRmRtService(R((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestNoGenericServices�scCsItj}|jtj|jtjj�|jtjj|jk�dS(N(RRR
t
_TESTALLTYPEStmessage_types_by_nameR3Rft_TESTALLTYPES_NESTEDMESSAGE(Rt	file_type((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestMessageTypesByName�s		cCs-tj}|jtj|jtjj�dS(N(RRR
RXRNR3(RRu((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestEnumTypesByName�s	cCs-tj}|jtj|jtjj�dS(N(RRR
tmy_extension_stringtextensions_by_nameR3(RRu((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestExtensionsByNames	cCs^tj�}|jd|jj�tj�}|jd|j�|jtjtjk�dS(Ni(	RRR
toptional_public_import_messageteRtPublicImportMessageR"R(Rtall_type_prototpublic_import_proto((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestPublicImports
scCsxtj�}|j|jtjd�|j|jtjd�|j|jtjd�|j|jtjd�dS(Ntfootbartbaztqux(RtTestBadIdentifiersR
t
ExtensionsR*t
descriptort
reflectionR(RR*((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestBadIdentifiersscCs<tjj}|jdt|j��|jd|jdj�|jd|jdj�|j||jdj	�|j|jd|j
d�tddddg�}|j|tg|jdjD]}|j^q���xV|j
j�D]E\}}||kr$|j|jd|j�q�|j|j�q�WdS(Nitoneof_fielditoneof_uint32toneof_nested_messagetoneof_stringtoneof_bytes(RRRR
tlentoneofsR3tindextassertIsR;toneofs_by_nameRQR2Rtitemstcontaining_oneoftassertIsNone(RR5tnested_namestfieldRt
field_desc((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyt	testOneof"s	-(t__name__t
__module__RRR+R9R?RBRGRKRPRVRWRZRaReRjRqRvRwRzR�R�R�(((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyR
>s,														
							tSymbolDatabaseRegistrationTestcBs)eZdZd�Zd�Zd�ZRS(s?Checks that messages, enums and files are correctly registered.cCs�|jtjtj�jd��|jtjjtj�jd��|jt��tj�jd�WdQX|jtjj	tj�jd��|jtjj
tj�jd��dS(Nsprotobuf_unittest.TestAllTypess,protobuf_unittest.TestAllTypes.NestedMessagesprotobuf_unittest.NestedMessages,protobuf_unittest.TestAllTypes.OptionalGroups,protobuf_unittest.TestAllTypes.RepeatedGroup(R
RRR	tDefaultt	GetSymbolRtassertRaisestKeyErrorRSRT(R((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyt
testGetSymbol8s"
	
	
	cCsN|jdtj�jjd�j�|jdtj�jjd�j�dS(Nsprotobuf_unittest.ForeignEnums)protobuf_unittest.TestAllTypes.NestedEnum(R
R	R�tpooltFindEnumTypeByNamet	full_name(R((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyRKs
cCs)|jdtj�jjd�j�dS(Nsgoogle/protobuf/unittest.proto(R
R	R�R�tFindFileByNameR3(R((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyttestFindFileByNameUs(R�R�t__doc__R�RR�(((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyR�5s		
t__main__(R�t
__author__t	unittest2tunittesttImportErrortgoogle.protobuf.internalRtgoogle.protobufRRRRRRRRR	RctTestCaseR
R�R�tmain(((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/generator_test.pyt<module>'s(
�&

?>